Repository navigation
fix(usage): use queued project context in stats-usage worker - #14106
Merged
Merged
Conversation
🟢 Tier S · Ready to merge
The stats-usage worker now uses the queued ProjectContext instead of resolving a project document from the platform database. It takes the tenant sequence from that context and removes the now-redundant payload-versus-resolved project ID check.
📂 Walkthrough · 1
Reviewed |
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
abnegate
added a commit
that referenced
this pull request
Oct 5, 2026
Merges main a2cca78 (#14009, #14106, #14117, #14115, #14119, #14114, #14101, #14125, #14129, #14127) so cloud#5410 can require a train head that contains main at or after 0ed7232. Conflicts: none. Database 8.0 port: none needed. Main's new code only uses Document getAttribute/setAttribute and Query::equal/lessThan/orderAsc/limit (Tasks/Interval.php), all unchanged in database 8.0; no removed Database::* constants, config collections, or model magic reads. composer.json and composer.lock are untouched by main, so the train's database and migration pins stay as they are. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2 tasks done
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The stats-usage worker injected `project`, which runs `getDocument('projects', ...)` on the platform database for every usage job. The worker only needs the project's `$id` and `$sequence`, and both are already in the queued payload. It now injects `projectContext` instead. I removed the payload-vs-resolved project ID check because it would only compare the payload with itself.
#13480 made the same change and was closed as CE-only. Since then, #13764 makes cloud extend this worker rather than keep its own copy, so the lookup would apply there too. #14086 also measured about 25 points less worker CPU from this change alone. The change doesn't overlap #13764 and merges cleanly with it.
Verification: a harness resolved the worker's injections through `app/init/worker/message.php` for 1000 jobs and counted project lookups. It saw 1000 `getDocument('projects')` calls before the change and 0 after. Pint and PHPStan pass on the changed file.
Part of #14086