Set schedule inactive after message send so deletes worker picks it up
This commit is contained in:
parent
a05a5da9bb
commit
ce78d8c473
3 changed files with 10 additions and 1 deletions
|
@ -70,6 +70,7 @@ abstract class ScheduleBase extends Action
|
|||
);
|
||||
|
||||
return [
|
||||
'$id' => $schedule->getId(),
|
||||
'resourceId' => $schedule->getAttribute('resourceId'),
|
||||
'schedule' => $schedule->getAttribute('schedule'),
|
||||
'resourceUpdatedAt' => $schedule->getAttribute('resourceUpdatedAt'),
|
||||
|
|
|
@ -50,6 +50,14 @@ class ScheduleMessages extends ScheduleBase
|
|||
->setProject($schedule['project'])
|
||||
->trigger();
|
||||
|
||||
$dbForConsole->updateDocument(
|
||||
'schedules',
|
||||
$schedule['$id'],
|
||||
$dbForConsole
|
||||
->getDocument('schedules', $schedule['$id'])
|
||||
->setAttribute('active', false)
|
||||
);
|
||||
|
||||
$queueForDeletes
|
||||
->setType(DELETE_TYPE_SCHEDULES)
|
||||
->setDocument($schedule)
|
||||
|
|
|
@ -134,7 +134,7 @@ class Messaging extends Action
|
|||
Query::equal('type', [$recipients[0]->getAttribute('providerType')]),
|
||||
]);
|
||||
|
||||
if ($fallback === false) {
|
||||
if ($fallback === false || $fallback->isEmpty()) {
|
||||
Console::error('No fallback provider found.');
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue