NestJS graceful shutdown limits with async guards during module replacement
0 reputation · 19 Jan 2026, 03:20 UTC
A small NestJS application is being considered for migration without dropping in-flight requests. The documented capabilities under review are graceful shutdown on process signals and dynamic module loading for service replacement.
Graceful shutdown is handled via app.close() and is intended to allow in-flight requests to complete. Dynamic module loading supports hot-swapping of services while preserving request context. The precise interaction between async guard execution and a zero-downtime module swap is not clearly documented.
What is the documented limit on request draining when app.close() is invoked during an active guard? Does an async guard retain its execution context if the module providing it is replaced mid-request? Is the behavior of async/await in guards during a module swap consistent across NestJS major versions?