-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds soft-delete for scenarios jobs to fix race condition
Race condition could happen when: - job was marked as finished in hermes worker - scenarion engine at the same time loaded finished jobs and deleted them - however, hermes worker was not yet finished with already deleted job This solution adds soft delete to scenarios_jobs - jobs are deleted from DB after given delay remp/crm#2732
- Loading branch information
Showing
3 changed files
with
77 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/migrations/20230124153728_add_soft_delete_to_scenarios_jobs.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
final class AddSoftDeleteToScenariosJobs extends AbstractMigration | ||
{ | ||
public function change(): void | ||
{ | ||
$this->table('scenarios_jobs') | ||
->addColumn('deleted_at', 'datetime', ['null' => true, 'after' => 'updated_at']) | ||
->addIndex('deleted_at') | ||
->update(); | ||
} | ||
} |