Skip to content

fix(throttler): continue draining queued tasks after a task fails - #11248

Merged
ajperel merged 1 commit into
mainfrom
ajp/throttler-drain
Oct 9, 2026
Merged

ajperel merged 1 commit into
mainfrom
ajp/throttler-drain

Conversation

@ajperel

@ajperel ajperel commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Description

When a throttled task exhausted its retries or timed out, Throttler did not schedule the next waiting task into the freed concurrency slot. During Cloud Functions deployments, if all active concurrency slots failed, remaining queued functions were never scheduled and the CLI exited early with code 0 instead of reporting deployment errors.

This change ensures the throttler continues processing queued tasks after a task failure.

Part of #6989
Part of #11040

Scenarios Tested

  • Unit tests verifying that Throttler and QueueExecutor continue draining queued tasks after retry exhaustion or task timeouts.

Sample Commands

firebase deploy --only functions

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request fixes an issue where throttled task queues stopped processing remaining tasks when a task exhausted its retries or timed out, by ensuring this.process() is called after this.finish(error). New tests have been added to verify this behavior. Feedback highlights a potential memory leak and redundant promise resolutions in the finish method because the this.waits array is not cleared after iteration.

Comment thread src/throttler/throttler.ts Resolved
@ajperel
ajperel added this pull request to stack #11256 October 9, 2026 20:54
@ajperel
ajperel force-pushed the ajp/throttler-drain branch 2 times, most recently from b712165 to 2dac944 Compare October 9, 2026 22:00
@ajperel
ajperel requested a review from joehan October 9, 2026 22:28

@joehan joehan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Love a 1 line of real code, 1 changelog entry, 100 lines of tests PR

When a throttled task exhausted its retries or timed out, `Throttler` did not schedule the next waiting task into the freed concurrency slot. During Cloud Functions deployments, if all active concurrency slots failed, remaining queued functions were never scheduled and the CLI exited early with code `0` instead of reporting deployment errors.

This change ensures the throttler continues processing queued tasks after a task failure.

Part of #6989
Part of #11040

- Unit tests verifying that `Throttler` and `QueueExecutor` continue draining queued tasks after retry exhaustion or task timeouts.

```bash
firebase deploy --only functions
```
@ajperel
ajperel force-pushed the ajp/throttler-drain branch from 2dac944 to a5c0f7e Compare October 9, 2026 23:11
@ajperel
ajperel merged commit b0f51bf into main Oct 9, 2026
51 checks passed
@ajperel
ajperel deleted the ajp/throttler-drain branch October 9, 2026 23: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.

2 participants