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 [
|
return [
|
||||||
|
'$id' => $schedule->getId(),
|
||||||
'resourceId' => $schedule->getAttribute('resourceId'),
|
'resourceId' => $schedule->getAttribute('resourceId'),
|
||||||
'schedule' => $schedule->getAttribute('schedule'),
|
'schedule' => $schedule->getAttribute('schedule'),
|
||||||
'resourceUpdatedAt' => $schedule->getAttribute('resourceUpdatedAt'),
|
'resourceUpdatedAt' => $schedule->getAttribute('resourceUpdatedAt'),
|
||||||
|
|
|
@ -50,6 +50,14 @@ class ScheduleMessages extends ScheduleBase
|
||||||
->setProject($schedule['project'])
|
->setProject($schedule['project'])
|
||||||
->trigger();
|
->trigger();
|
||||||
|
|
||||||
|
$dbForConsole->updateDocument(
|
||||||
|
'schedules',
|
||||||
|
$schedule['$id'],
|
||||||
|
$dbForConsole
|
||||||
|
->getDocument('schedules', $schedule['$id'])
|
||||||
|
->setAttribute('active', false)
|
||||||
|
);
|
||||||
|
|
||||||
$queueForDeletes
|
$queueForDeletes
|
||||||
->setType(DELETE_TYPE_SCHEDULES)
|
->setType(DELETE_TYPE_SCHEDULES)
|
||||||
->setDocument($schedule)
|
->setDocument($schedule)
|
||||||
|
|
|
@ -134,7 +134,7 @@ class Messaging extends Action
|
||||||
Query::equal('type', [$recipients[0]->getAttribute('providerType')]),
|
Query::equal('type', [$recipients[0]->getAttribute('providerType')]),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($fallback === false) {
|
if ($fallback === false || $fallback->isEmpty()) {
|
||||||
Console::error('No fallback provider found.');
|
Console::error('No fallback provider found.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue