⚡ Bolt: Optimize JobEvent sequence number generation - #149
Conversation
… in get_max_sequence_no Co-authored-by: crabcanon <3458947+crabcanon@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
💡 What: Replaced loading$O(1)$ efficiency instead of $O(N)$ .
list_for_job(limit=1000)into memory to find the next sequence number with an efficient SQL aggregation queryget_max_sequence_no(func.max()).🎯 Why: Prevents loading unnecessary records into memory causing N+1 query-like inefficiencies. It allows generating the next sequence number with
📊 Impact: Considerably faster job event ingestion and lower memory overhead, especially for jobs with many events.
🔬 Measurement: Verify changes in db repositories and usages in
apps/api/src/cortex_api/services/jobs.pyand across job control services.Closes #performance
PR created automatically by Jules for task 17186085385971374420 started by @crabcanon