# JobQueueOptions.drain property · @imqueue/job

Source: https://imqueue.org/api/job/latest/job.jobqueueoptions.drain/
Published: 2026-08-31
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/job 3.3.0 — generated reference, not hand-written

Drain jobs still being handled before shutting down on `SIGTERM`/`SIGINT`, instead of exiting from under them.

**Signature:**

```typescript
drain?: boolean;
```

## Default Value

the `IMQ_DRAIN_ENABLE` environment variable, itself `false`

## Remarks

Opt-in, and nothing about a queue with it off differs from before it existed. Left off, `@imqueue/core`'s own signal handlers release the watcher locks and exit without waiting, so a job in flight loses that attempt.

Turned on, `SIGTERM` and `SIGINT` instead stop popping, wait up to [JobQueueOptions.drainTimeout](https://imqueue.org/api/job/latest/job.jobqueueoptions.draintimeout/) for the handlers already running — including the re-schedule a handler asked for — then release the connection and exit `0`. Enabling it also suppresses the queue layer's own handlers, which would otherwise exit the process mid-drain.

Every drain-enabled queue in the process drains together under one signal handler, so a publisher and a worker side by side do not exit from under each other.

Delivery stays at-least-once. A drain narrows the window in which an attempt is lost; it does not close it.

