Skip to content

fix: do not resolve the queue manager when warming up the app - #12

Merged
RomainLanz merged 2 commits into
adonisjs:0.xfrom
DavideCarvalho:fix/warmup-mode
Oct 18, 2026
Merged

RomainLanz merged 2 commits into
adonisjs:0.xfrom
DavideCarvalho:fix/warmup-mode

Conversation

@DavideCarvalho

Copy link
Copy Markdown

What

QueueProvider no longer resolves the queue.manager binding in boot() (nor loads jobs in start()) when the app runs in the warmup mode. Behavior in the run mode is unchanged. getMode is called with optional chaining since older versions of the framework core within the ^7.0.0 peer range don't have it.

Why

node ace codegen boots the app in the warmup mode (app.boot() + app.warmUp()) and then calls app.terminate(), which intentionally skips the providers' shutdown hooks for such an app:

Such an app never gets started and therefore it has nothing to tear down. Since every shutdown hook begins by resolving its manager from the container, invoking them would construct the very resources the warmed up app has avoided creating.

So providers must not open connections during register/boot in this mode. Today boot() resolves the queue manager, which resolves the adapters, and the redis driver acquires an ioredis connection right away. Nothing ever closes it, so node ace codegen never exits (in a real app we found dozens of hung codegen processes holding several GBs of memory).

The manager is still resolved lazily if something asks for it (for example services/main).

Related: #9 tackled the connection side by making the drivers lazy, but it was closed without merging.

Tests

  • Added a test that sets up the app in the warmup mode, boots and warms it up, and asserts the adapter's config provider is never resolved and no jobs are loaded. It fails without the fix.
  • Added a test asserting the adapters are still resolved on boot in the run mode.
  • npm test, npm run lint and npm run typecheck pass.

🤖 Generated with Claude Code

Davi de Carvalho and others added 2 commits October 18, 2026 09:37
A warmed up app never gets started and its providers are never shut
down. Resolving the queue manager during boot opens the adapter
connections (for example, redis), which keeps the process alive after
commands like "node ace codegen" terminate the app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The core peer dependency is now ^7.6.0, which always ships getMode and
the warmup mode, so the defensive optional call is no longer needed.
@RomainLanz
RomainLanz merged commit 0dab5b6 into adonisjs:0.x Oct 18, 2026
8 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.

2 participants