Skip to content

fix: prevent NotFoundException during console project maintenance#12232

Open
ShameelMohamed wants to merge 2 commits into
appwrite:1.9.xfrom
ShameelMohamed:fix-console-maintenance-deletes
Open

fix: prevent NotFoundException during console project maintenance#12232
ShameelMohamed wants to merge 2 commits into
appwrite:1.9.xfrom
ShameelMohamed:fix-console-maintenance-deletes

Conversation

@ShameelMohamed
Copy link
Copy Markdown

@ShameelMohamed ShameelMohamed commented May 7, 2026

This PR implements Option A from issue #12230. It adds a guard clause in deleteOldDeployments to skip the deletion process if the functions or sites collections do not exist in the project schema. This safely prevents the daily NotFound exception from firing on the console project.

Closes #12230

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 7, 2026

Greptile Summary

This PR adds a guard clause in deleteOldDeployments to skip the listByGroup call when a collection (functions or sites) does not exist in the project schema, preventing a daily NotFoundException on the console project during maintenance.

  • Replaces two separate listByGroup calls with a loop that checks $dbForProject->getCollection($group)->isEmpty() before iterating — matching the established pattern already used in Migration.php (line 253) and Version/V22.php.
  • The removalCallback (which queries deployments) is never invoked when the outer collection is absent, so the inner deleteByGroup call is also safe.

Confidence Score: 5/5

Safe to merge — the guard clause is minimal, well-precedented in this codebase, and directly fixes the reported exception without touching other code paths.

The change is a two-line guard wrapping an existing call. The getCollection()->isEmpty() pattern is already used in Migration.php and V22.php for the same purpose, so its semantics are established. No new failure modes are introduced.

No files require special attention.

Important Files Changed

Filename Overview
src/Appwrite/Platform/Workers/Deletes.php Adds a getCollection()->isEmpty() guard in deleteOldDeployments to skip missing functions/sites collections (e.g. on the console project), preventing a daily NotFoundException.

Reviews (2): Last reviewed commit: "Merge branch '1.9.x' into fix-console-ma..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Daily maintenance crashes on console project: Collection not found from deleteOldDeployments (self-hosted 1.9.x)

1 participant