From 71dff441edf41a3088604027e9e11782cc83af3f Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 5 Mar 2026 20:03:42 +0530 Subject: [PATCH] fix: Update in-memory project document after accessedAt update Previously, the updateProjectAccess method updated the database with the new accessedAt timestamp but did not update the in-memory project document. This caused the if statement to constantly evaluate to true on subsequent calls, triggering unnecessary database updates. --- src/Appwrite/Platform/Tasks/ScheduleBase.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index cff94bfbea..c55e3d4a6a 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -59,9 +59,11 @@ abstract class ScheduleBase extends Action if (!$project->isEmpty() && $project->getId() !== 'console') { $accessedAt = $project->getAttribute('accessedAt', 0); if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $accessedAt) { + $now = DateTime::now(); $dbForPlatform->updateDocument('projects', $project->getId(), new Document([ - 'accessedAt' => DateTime::now() + 'accessedAt' => $now ])); + $project->setAttribute('accessedAt', $now); } } }