From ea38a7f869ab1345352d4718d46b90ef3b9cc4e6 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Wed, 30 Apr 2025 13:05:31 +1200 Subject: [PATCH] Coroutine sleep --- src/Appwrite/Platform/Tasks/ScheduleFunctions.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/ScheduleFunctions.php b/src/Appwrite/Platform/Tasks/ScheduleFunctions.php index 11072170d7..12da0a689c 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleFunctions.php +++ b/src/Appwrite/Platform/Tasks/ScheduleFunctions.php @@ -72,7 +72,7 @@ class ScheduleFunctions extends ScheduleBase foreach ($delayedExecutions as $delay => $scheduleKeys) { \go(function () use ($delay, $scheduleKeys, $pools, $dbForPlatform) { - \sleep($delay); // in seconds + \Co::sleep($delay); // in seconds foreach ($scheduleKeys as $scheduleKey) { // Ensure schedule was not deleted @@ -84,9 +84,7 @@ class ScheduleFunctions extends ScheduleBase $this->updateProjectAccess($schedule['project'], $dbForPlatform); - $publisher = new BrokerPool($pools->get('publisher')); - - $queueForFunctions = new Func($publisher); + $queueForFunctions = new Func($this->publisher); $queueForFunctions ->setType('schedule')