Skip to content

implement concurrency scheduler for bulkrepo actions - #67

Open
Facelessism wants to merge 1 commit into
kanak227:mainfrom
Facelessism:scheduler
Open

Facelessism wants to merge 1 commit into
kanak227:mainfrom
Facelessism:scheduler

Conversation

@Facelessism

@Facelessism Facelessism commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

📝 Description

This PR implements a configurable concurrency scheduler for bulk GitHub operations to improve execution efficiency and reduce the likelihood of API rate-limit issues. Refactored the bulk action service to use a queue-based concurrency mechanisms.

🔗 Related Issue

Closes #66

📂 Type of Change

Please check the relevant option(s):

  • Bug fix
  • New feature
  • Enhancement
  • Documentation update
  • Refactoring
  • Test addition
  • Performance improvement

🧪 How Has This Been Tested?

Describe the tests you ran and the steps to verify your changes.

📸 Screenshots / GIFs (if applicable)

Add screenshots or GIFs to demonstrate UI changes.

✅ Checklist

  • My code follows the project's coding style.
  • I have tested my changes locally.
  • I have updated the documentation if necessary.
  • My changes do not break existing functionality.
  • I have linked the related issue.
  • I have resolved any merge conflicts.

📌 Additional Notes

Any extra information for reviewers.

Summary by CodeRabbit

  • Performance Improvements

    • Repository actions now run in parallel with a configurable concurrency limit, improving processing speed for bulk operations.
    • Results remain organized in their original repository order.
  • Bug Fixes

    • Improved validation for bulk action inputs.
    • Simplified and clarified failure reporting for unsuccessful repository actions.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Bulk repository actions now run through a configurable concurrency scheduler. The scheduler bounds parallel workers and preserves result ordering, while bulkRepoAction adds validation and simplified failure reporting without rate-limit retries.

Changes

Bulk repository concurrency

Layer / File(s) Summary
Concurrency scheduler contract and execution
server/src/utils/githubScheduler.js
Adds runWithConcurrency, which validates inputs, normalizes the concurrency limit, executes asynchronous workers in parallel, and returns results in input order.
Bulk action scheduling and result mapping
server/src/services/bulkRepoAction.service.js
Updates bulkRepoAction to validate action and successStatus, delegate repository processing to the scheduler, and return success or simplified failure objects without automatic 429 retries.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant bulkRepoAction
  participant runWithConcurrency
  participant RepositoryAction
  bulkRepoAction->>runWithConcurrency: submit repositories and concurrency
  runWithConcurrency->>RepositoryAction: execute bounded worker calls
  RepositoryAction-->>runWithConcurrency: return action result
  runWithConcurrency-->>bulkRepoAction: return ordered results
Loading

Possibly related PRs

Suggested labels: gssoc:approved, type:feature, level:intermediate, quality:clean

Suggested reviewers: ayushisrivastava-hue

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly names the main change: adding a concurrency scheduler for bulk repo actions.
Description check ✅ Passed The description matches the template and includes the summary, issue link, type, and checklist, but the testing section is blank.
Linked Issues check ✅ Passed The changes add a reusable queue-based concurrency scheduler and route bulk repo actions through it with a configurable limit, matching #66.
Out of Scope Changes check ✅ Passed All changes stay within the bulk action service and new scheduler utility, and they directly support the requested feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
server/src/utils/githubScheduler.js (1)

35-45: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Worker errors aren't isolated — in-flight workers keep running after the batch rejects.

If worker() throws for one item, that executeWorker loop rejects and propagates through Promise.all, but the other concurrently-running executeWorker loops are not stopped — they keep pulling and executing items in the background even though the caller has already received a rejection, and whatever they compute into results is discarded. For a utility meant to be reused across future bulk operations, this means a single failure can silently leave extra in-flight API calls running with no observable outcome, and callers get no partial results on failure.

Today bulkRepoAction guards against this by always catching inside its own worker, but that's an implicit contract this file doesn't document or enforce.

♻️ Suggested guard
   const executeWorker = async () => {
     while (true) {
       const index = nextIndex++;

       if (index >= items.length) {
         return;
       }

-      results[index] = await worker(items[index], index);
+      try {
+        results[index] = await worker(items[index], index);
+      } catch (error) {
+        results[index] = { error };
+      }
     }
   };

Alternatively, if throwing is intended to abort the whole batch, document that contract explicitly in the JSDoc so future callers know they must handle their own errors.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@server/src/utils/githubScheduler.js` around lines 35 - 45, Update the worker
orchestration around executeWorker and its Promise.all handling so a worker
failure signals cancellation to all other in-flight loops and prevents them from
pulling or executing additional items. Ensure the batch rejection remains
observable to the caller while already-running workers stop cooperatively;
alternatively, explicitly document in the relevant JSDoc that worker errors
abort the batch and callers must handle worker errors themselves.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@server/src/utils/githubScheduler.js`:
- Around line 35-45: Update the worker orchestration around executeWorker and
its Promise.all handling so a worker failure signals cancellation to all other
in-flight loops and prevents them from pulling or executing additional items.
Ensure the batch rejection remains observable to the caller while
already-running workers stop cooperatively; alternatively, explicitly document
in the relevant JSDoc that worker errors abort the batch and callers must handle
worker errors themselves.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8d0d81d0-3be3-4ecc-9aa9-2167d47e1724

📥 Commits

Reviewing files that changed from the base of the PR and between c27a400 and 300ea90.

📒 Files selected for processing (2)
  • server/src/services/bulkRepoAction.service.js
  • server/src/utils/githubScheduler.js

@Facelessism

Copy link
Copy Markdown
Contributor Author

@kanak227 :⁠-⁠)

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.

[Feature]: Implement a configurable concurrency scheduler for bulk GitHub operations

1 participant