Skip to content

Commit a12e8aa

Browse files
Merge pull request #2908 from BrunnerLivio/feature/terminus-graceful-shutdown
docs(terminus): add section for graceful shutdown
2 parents 6a373ad + 568d0fe commit a12e8aa

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

content/recipes/terminus.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,24 @@ You can change the log style using the `errorLogStyle` configuration option as i
608608
export class HealthModule {}
609609
```
610610

611+
#### Graceful shutdown timeout
612+
613+
If your application requires postponing its shutdown process, Terminus can handle it for you.
614+
This setting can prove particularly beneficial when working with an orchestrator such as Kubernetes.
615+
By setting a delay slightly longer than the readiness check interval, you can achieve zero downtime when shutting down containers.
616+
617+
```typescript
618+
@@filename(health.module)
619+
@Module({
620+
imports: [
621+
TerminusModule.forRoot({
622+
gracefulShutdownTimeoutMs: 1000,
623+
}),
624+
]
625+
})
626+
export class HealthModule {}
627+
```
628+
611629
#### More examples
612630

613631
More working examples are available [here](https://github.com/nestjs/terminus/tree/master/sample).

0 commit comments

Comments
 (0)