You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Task: Create Batch Job to Run Aggregation Query and Update hit_count recordsΒ #357
As noted in #355 the aggregation query (SELECT COUNT(*) FROM hits WHERE repo_id = 123) π
takes 2 MINUTES on a table with 30 Million Rows. β³
And is the reason the request/query time-out and crashes the server! π
So we're implementing hit_count π
which is just an integer counter 1οΈβ£
to return millisecond responses again. ποΈ π π
The problem is that we are temporarily ignoring the historical data in the hits table ... π
But the data is not "lost" it's just in stasis. π
So ...
Todo
Create a batch job to go through the hit_count table
and update count to reflect the aggregate from hits. π§βπ»
This must be done gradually to avoid crashing the server again. βοΈ
Once all records are updated, we can sunset this data migration script. π
I expect writing the script to take around T1h and running it to take T1w β³
(Running the script once per minute to process a single record. 1440 runs per day. 10,000/week)
Will work on this immediately after I have #355 working.
Using quantumhttps://github.com/quantum-elixir/quantum-core for this task as it has all the scaffold for what we need.
It's a temporary dependency and will be removed once all data is migrated. β
Activity
add test for legacy Hit.count_hits/1 function #357
nelsonic commentedon Jul 13, 2026
A Practical Guide to Elixirβs Task Module β Letβs create a Cron Job: https://medium.com/@Vickris/a-practical-guide-to-elixirs-task-module-let-s-create-a-cron-job-4c6afe74b846
nelsonic commentedon Jul 14, 2026
PR: #360 π§βπ» β³
nelsonic commentedon Jul 14, 2026
Using
quantumhttps://github.com/quantum-elixir/quantum-core for this task as it has all the scaffold for what we need.It's a temporary dependency and will be removed once all data is migrated. β
add :quantum to mix.exs for #357
create Hits.Cron for #357
Merge pull request #360 from dwyl/aggregation-backfill-task-issue-#357
asntc commentedon Jul 15, 2026
The
quantumcron job works fine. The issue is duplicate entries in the DB: #365nelsonic commentedon Jul 15, 2026
Yeah, we need to figure this out tomorrow ... π§βπ» π€
nelsonic commentedon Jul 15, 2026
GOTO: #366