# RedisQueue.destroy() method · @imqueue/core

Source: https://imqueue.org/api/core/latest/core.redisqueue.destroy/
Published: 2026-08-04
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/core 3.3.2 — generated reference, not hand-written

Gracefully destroys this queue handle. Does not remove queue data from redis unless clearData is explicitly set to true, so that destroying one handle (e.g., on scale-down) never wipes messages still pending for other producers/consumers.

**Signature:**

```typescript
destroy(clearData?: boolean): Promise<void>;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| clearData | boolean | _(Optional)_ when true, also clears queue data |


**Returns:**

Promise<void>

## Remarks

The writer connection is shared per `host:port` and reference-counted, so it stays open while another started instance in the process still uses it.

All event listeners are removed, including the caller's `message` and `error` handlers — and because [RedisQueue.start()](https://imqueue.org/api/core/latest/core.redisqueue.start/) can revive the instance, re-register them if you restart it or messages will be consumed and silently discarded.

With `clearData` set, only the main and delayed keys are removed: messages currently leased to a worker key under [IMQOptions.safeDelivery](https://imqueue.org/api/core/latest/core.imqoptions.safedelivery/) are not, and the watcher will re-queue them once their lease expires — so messages can reappear after a clearing destroy.

Never rejects; unlock and clear failures are logged.

