Skip to content

Conversation

@rodrigopedra
Copy link
Contributor

PR #57800 added the QueueManager@pause() method to allow pausing a given queue.

This method pauses the queue indefinitely by using a cache's store forever() method.

As such a queue can only be resumed by calling the QueueManager@resume() method added in the same PR.

When consuming an external API with rate limiting, one can get a 429 response when the rate limit is surpassed.

Often times this response is accompanied by the Retry-After header that gives the number of seconds to wait before retrying.

Currently, one would need to keep track of those seconds to manually pause a queue (when a 429 response is received) and manually resume a queue (when the timeout is expired).

This PR

  • Adds the QueueManager@pauseFor() method that allows passing the number of seconds a queue should be paused.
  • Fixes some test cases and adds relevant assertions to test for the presented use case.
    • It seems the original PR aimed for allowing the seconds to be passed, so there were already tests in place testing for a third $seconds argument.

Button99

This comment was marked as resolved.

@taylorotwell taylorotwell merged commit 9538b23 into laravel:12.x Nov 26, 2025
74 checks passed
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.

4 participants