Skip to content

Commit

Permalink
Merge pull request #2908 from BrunnerLivio/feature/terminus-graceful-…
Browse files Browse the repository at this point in the history
…shutdown

docs(terminus): add section for graceful shutdown
  • Loading branch information
kamilmysliwiec authored Nov 27, 2023
2 parents 6a373ad + 568d0fe commit a12e8aa
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions content/recipes/terminus.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,24 @@ You can change the log style using the `errorLogStyle` configuration option as i
export class HealthModule {}
```

#### Graceful shutdown timeout

If your application requires postponing its shutdown process, Terminus can handle it for you.
This setting can prove particularly beneficial when working with an orchestrator such as Kubernetes.
By setting a delay slightly longer than the readiness check interval, you can achieve zero downtime when shutting down containers.

```typescript
@@filename(health.module)
@Module({
imports: [
TerminusModule.forRoot({
gracefulShutdownTimeoutMs: 1000,
}),
]
})
export class HealthModule {}
```

#### More examples

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

0 comments on commit a12e8aa

Please sign in to comment.