{{ message }}
Repository navigation
feat(stats-resources): spread project counts across the interval with the scheduler - #13669
Merged
Merged
Conversation
Contributor
|
Member
Author
loks0n
force-pushed
the
claude/stats-resources-utopia-scheduler-1d1c1e
branch
from
September 14, 2026 19:56
6ad1d9a to
16a8a45
Compare
loks0n
enabled auto-merge
September 14, 2026 22:05
… the scheduler Replace the hourly Console::loop that enqueued every active project at once with a Utopia\Schedule\Scheduler over a Stats source. Each project takes a slot derived from its id inside the interval, as scheduled functions do, so a region's resource counts spread across the hour instead of bursting at the top of it. Concurrency sampling keeps its cadence as a row of the same source. Incremental syncs read the accessedAt index every minute and a full snapshot runs once per interval, so platform DB load stays where it was. Project sub-queries are skipped in the source instead of disabled globally. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Only the id is read, so no filter needs to run. Skipping them all rather than APP_PROJECTS_SUBQUERIES also covers subqueries Cloud registers on projects, which is the one thing Cloud overrode on this task. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ouble The double now answers region, accessedAt, order, limit and cursor queries, so the tests prove stale and out-of-region projects are excluded, since() honours its cutoff, and paging covers every project. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…or more Disabling every filter also skipped the JSON decode of collection metadata, and the shared collection cache then handed HTTP a string where it expected attributes. Skip the named project subqueries as Source\Database does, and let an edition extend the list through a protected hook, as ScheduleFunctions does for spreadWindow. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
loks0n
force-pushed
the
claude/stats-resources-utopia-scheduler-1d1c1e
branch
from
September 15, 2026 09:24
16a8a45 to
24530f0
Compare
loks0n
disabled auto-merge
September 15, 2026 10:02
abnegate
added a commit
that referenced
this pull request
Sep 22, 2026
Re-apply the stats-calculations/stats-events split on top of #13669's scheduler-based task and #13814's queue-5 worker configuration: the renamed Tasks\StatsCalculations keeps main's Utopia\Schedule\Scheduler body and subqueries hook, Schedule.php passes telemetry through, and workers.php uses the new coroutines key for both queues. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

What does this PR do?
The
stats-resourcestask enqueued every active project in the region at the top of every interval, so the worker (maxCoroutines: 1) got an hourly burst and sat idle the rest of the hour.It now runs on
Utopia\Schedule\Scheduler, likeScheduleFunctions,ScheduleExecutionsandScheduleMessages:Appwrite\Schedule\Source\Statslists aconcurrencyrow plus every project accessed in the last day in this region. Each project gets aShifted(Interval)trigger with an offset derived from its id, the same spreadSource\Functionsuses, so its slot is stable across restarts and a region's counts spread evenly across the interval.(region, accessedAt)index every minute (or every interval when it is shorter, for test stacks); a full snapshot runs once per interval. Platform DB read cost stays at today's level.skipFiltersinside the source, asSource\Databasedoes, instead ofdisableSubqueries(), which mutated the global filter set in the combined scheduler process. A protectedsubqueries()hook on the task lets Cloud add its own filter names, the same shape as thespreadWindowhook onScheduleFunctions.schedule.stats.{reconcile,enqueue,stopped}spans withoccurrence.*attributes, and every failure is caught so one bad occurrence never ends the loop.Test Plan
tests/unit/Schedule/Sourcepass; the E2E usage suites exercise the task end to end.Related PRs and Issues
Cloud follow-up: appwrite-labs/cloud#5829 overrides the new
subqueries()hook and re-points itscomposer.lockonce this merges.Checklist
🤖 Generated with Claude Code