Repository navigation
Conversation
Greptile SummaryThis PR removes the platform-database project lookup from the usage worker and uses the project identity and sequence already carried by each queued usage message.
Confidence Score: 5/5The PR appears safe to merge because the worker resource is available and existing usage messages already carry the required project ID and sequence. The changed worker consumes the same project fields serialized by the established usage-message producer, while avoiding the previous database lookup; no build, compatibility, or tenant-attribution failure remains. Important Files Changed
Reviews (1): Last reviewed commit: "perf(stats): use queued project context" | Re-trigger Greptile |
|
Closing because the optimization is CE-only; Appwrite Cloud already avoids this project lookup in its custom stats-usage worker. |
What changed
ProjectContextinto the stats-usage worker instead of resolving the current project documentWhy
Usage is event-time data. Resolving the mutable platform project for every queued usage message adds a platform database/cache read and can discard attribution when a project is deleted before its already-enqueued usage is consumed. The message already carries the immutable identity needed by this worker.
Cloud has a separate batched stats-usage implementation that already consumes the queued project payload without resolving the platform project. This change optimizes the CE worker path.
Verification
php -l src/Appwrite/Platform/Workers/StatsUsage.phpsrc/Appwrite/Platform/Workers/StatsUsage.phpsrc/Appwrite/Platform/Workers/StatsUsage.phpNo worker unit test was added because this repository requires worker behavior to be covered through E2E rather than unit-testing action internals; this dependency-only change has no dedicated stats-usage E2E seam.