Skip to content

fix: correct queue counts for distributed runs#1992

Merged
yottahmd merged 1 commit intomainfrom
fix/queue-counts
Apr 11, 2026
Merged

fix: correct queue counts for distributed runs#1992
yottahmd merged 1 commit intomainfrom
fix/queue-counts

Conversation

@yottahmd
Copy link
Copy Markdown
Collaborator

@yottahmd yottahmd commented Apr 11, 2026

Summary

  • stop subtracting running distributed DAG runs from queueStore.Len(), which already reports only queued items
  • add regression coverage for a queue that has both one distributed running run and one queued run
  • keep the queue API aligned with the queue details UI so mixed running/queued states report the correct counts

Test plan

  • go test ./internal/service/frontend/api/v1

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Fixed queue status reporting to accurately count running and queued items separately, ensuring metrics properly reflect the distribution of items across different queue states.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a809bb0c-086a-4709-94c6-0c1c5b96fa42

📥 Commits

Reviewing files that changed from the base of the PR and between aaa964c and f75f600.

📒 Files selected for processing (2)
  • internal/service/frontend/api/v1/queues.go
  • internal/service/frontend/api/v1/queues_internal_test.go

📝 Walkthrough

Walkthrough

Modified the queuedCount calculation in the collectQueues function to return the queue store count directly instead of subtracting the running items count and clamping negative values. Added a test to verify that running and queued items are tracked separately.

Changes

Cohort / File(s) Summary
Queue Count Calculation
internal/service/frontend/api/v1/queues.go
Changed queuedCount computation from max(count-len(queue.running), 0) to count, removing the subtraction of running items and negative value clamping in both filtered and all-queues paths.
Queue Count Verification
internal/service/frontend/api/v1/queues_internal_test.go
Added new test TestGetQueueCountsQueuedItemsSeparatelyFromRunningItems to validate that running and queued item counts remain separate, with setup for persistence stores and assertions on running and queued count values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: correct queue counts for distributed runs' accurately describes the main change: fixing queue count calculations for distributed runs by removing incorrect subtraction of running items from queued counts.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/queue-counts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@yottahmd yottahmd merged commit ddcabd5 into main Apr 11, 2026
3 checks passed
@yottahmd yottahmd deleted the fix/queue-counts branch April 11, 2026 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant