RedisQueue.destroy() method

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:

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() 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 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.

Read this page as plain markdown — no HTML, no navigation. For pasting into an LLM, or for an agent to fetch.