From 74c97a833c2739142cc3e0eaf9dd4042296d8232 Mon Sep 17 00:00:00 2001 From: Khushboo Verma <43381712+vermakhushboo@users.noreply.github.com> Date: Sat, 19 Aug 2023 18:30:22 +0530 Subject: [PATCH] Removed null check for scheduleId --- app/workers/builds.php | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/app/workers/builds.php b/app/workers/builds.php index 220e3b9cfc..806e005082 100644 --- a/app/workers/builds.php +++ b/app/workers/builds.php @@ -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);