From 1084631d0f8e5b31aef5381773779c8a986d5aff Mon Sep 17 00:00:00 2001 From: Matej Baco Date: Tue, 15 Nov 2022 12:23:08 +0100 Subject: [PATCH] Fux reclaim logic in CLI; Prevent early executions --- app/cli.php | 2 +- src/Appwrite/Platform/Tasks/schedule.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/cli.php b/app/cli.php index 3546674a13..c84adef11c 100644 --- a/app/cli.php +++ b/app/cli.php @@ -70,7 +70,7 @@ CLI::setResource('getProjectDB', function (Group $pools, Database $dbForConsole, $database = new Database($dbAdapter, $cache); $database->setNamespace('_' . $project->getInternalId()); - return [ $database, fn() => $connection->claim() ]; + return [ $database, fn() => $connection->reclaim() ]; }; return $getProjectDB; diff --git a/src/Appwrite/Platform/Tasks/schedule.php b/src/Appwrite/Platform/Tasks/schedule.php index ca1de4164e..798353ef57 100644 --- a/src/Appwrite/Platform/Tasks/schedule.php +++ b/src/Appwrite/Platform/Tasks/schedule.php @@ -184,7 +184,7 @@ class Schedule extends Action $executionStart = $nextDate->getTimestamp(); // in seconds $executionSleep = $executionStart - $promiseStart; // Time to wait from now until execution needs to be queued - $delay = \intval($executionSleep); + $delay = \ceil(\intval($executionSleep)); if(!isset($delayedExecutions[$delay])) { $delayedExecutions[$delay] = [];