1
0
Fork 0
mirror of synced 2024-10-01 01:37:56 +13:00

Removed null check for scheduleId

This commit is contained in:
Khushboo Verma 2023-08-19 18:30:22 +05:30
parent 78a224be14
commit 74c97a833c

View file

@ -450,15 +450,12 @@ class BuildsV1 extends Worker
/** Update function schedule */
$dbForConsole = $this->getConsoleDB();
// Inform scheduler if function is still active
$scheduleId = $function->getAttribute('scheduleId', '');
if (!empty($scheduleId)) {
$schedule = $dbForConsole->getDocument('schedules', $scheduleId);
$schedule
->setAttribute('resourceUpdatedAt', DateTime::now())
->setAttribute('schedule', $function->getAttribute('schedule'))
->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment')));
Authorization::skip(fn () => $dbForConsole->updateDocument('schedules', $schedule->getId(), $schedule));
}
$schedule = $dbForConsole->getDocument('schedules', $function->getAttribute('scheduleId'));
$schedule
->setAttribute('resourceUpdatedAt', DateTime::now())
->setAttribute('schedule', $function->getAttribute('schedule'))
->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment')));
Authorization::skip(fn () => $dbForConsole->updateDocument('schedules', $schedule->getId(), $schedule));
} catch (\Throwable $th) {
$endTime = DateTime::now();
$durationEnd = \microtime(true);