1
0
Fork 0
mirror of synced 2024-07-06 23:21:05 +12:00

Set schedule inactive after message send so deletes worker picks it up

This commit is contained in:
Jake Barnby 2024-01-15 19:29:19 +13:00
parent a05a5da9bb
commit ce78d8c473
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C
3 changed files with 10 additions and 1 deletions

View file

@ -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'),

View file

@ -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)

View file

@ -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;
}