queue-jobs-worker 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2348,6 +2348,8 @@ var QueueClient = class _QueueClient {
2348
2348
  queues = /* @__PURE__ */ new Map();
2349
2349
  initialised = false;
2350
2350
  closed = false;
2351
+ /** True when the adapter was supplied via {@link withAdapter}; init() skips resolveAdapter() in that case. */
2352
+ _customAdapter = false;
2351
2353
  constructor(options = {}) {
2352
2354
  this.defaults = { ...HARD_DEFAULTS, ...options.defaults };
2353
2355
  this.dialect = options.dialect ?? "memory";
@@ -2383,7 +2385,9 @@ var QueueClient = class _QueueClient {
2383
2385
  */
2384
2386
  async init() {
2385
2387
  if (this.initialised) return;
2386
- this._storage = await this.resolveAdapter();
2388
+ if (!this._customAdapter) {
2389
+ this._storage = await this.resolveAdapter();
2390
+ }
2387
2391
  await this._storage.initialize();
2388
2392
  this.initialised = true;
2389
2393
  }
@@ -2500,6 +2504,7 @@ var QueueClient = class _QueueClient {
2500
2504
  static withAdapter(adapter, options = {}) {
2501
2505
  const client = new _QueueClient(options);
2502
2506
  client._storage = adapter;
2507
+ client._customAdapter = true;
2503
2508
  return client;
2504
2509
  }
2505
2510
  };