Repository navigation
fix(provider): accept schedules while warming up the app - #15
Open
RomainLanz wants to merge 2 commits into
Open
RomainLanz wants to merge 2 commits into
RomainLanz wants to merge 2 commits into
Conversation
A warmed up app never initializes the queue manager, but preload files such as "start/scheduler.ts" still run. Defining a schedule there made `node ace codegen` fail with "QueueManager is not initialized", forcing apps to guard their scheduler with `app.getMode()`. While warming up, the provider now initializes the queue manager with a fake adapter in place of every configured adapter. Schedules and dispatches become no-ops, and no connection is opened.
The fake adapter used while warming up the app holds delayed jobs in a
setTimeout. A warmed up app never shuts its providers down, so a
preload dispatching with `.in('1h')` kept `node ace codegen` running
until the delay elapsed.
The warmup adapter now pushes delayed jobs right away, which leaves no
timer behind and still never executes them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A warmed up app never initializes the queue manager, but preload files such as
start/scheduler.tsstill run. Defining a schedule there makesnode ace codegenfail with "QueueManager is not initialized", so apps have to guard their scheduler withapp.getMode() !== 'warmup'.While warming up, the provider now initializes the queue manager with an in-memory fake adapter in place of every configured adapter, so schedules and dispatches made from preload files no longer throw. Delayed dispatches are stored right away instead of through a timer, which would otherwise keep the command running until the delay elapses.