queue-jobs-worker 1.0.0 → 1.0.1

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
@@ -292,10 +292,11 @@ return job_id
292
292
  // Release lock
293
293
  // -------------------------------------------------------------------------
294
294
  async releaseLock(jobId) {
295
+ const now = (/* @__PURE__ */ new Date()).toISOString();
295
296
  await this.client.hSet(k.job(jobId), {
296
297
  lockId: "",
297
- lockExpiresAt: "",
298
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
298
+ lockExpiresAt: now,
299
+ updatedAt: now
299
300
  });
300
301
  }
301
302
  // -------------------------------------------------------------------------
@@ -676,7 +677,7 @@ CREATE TABLE IF NOT EXISTS qjw_rate_limits (
676
677
  async releaseLock(jobId) {
677
678
  await this.pool.query(
678
679
  `UPDATE qjw_jobs
679
- SET lock_id = NULL, lock_expires_at = NULL, updated_at = NOW()
680
+ SET lock_id = NULL, lock_expires_at = NOW(), updated_at = NOW()
680
681
  WHERE id = $1`,
681
682
  [jobId]
682
683
  );
@@ -1027,7 +1028,7 @@ CREATE TABLE IF NOT EXISTS qjw_rate_limits (
1027
1028
  async releaseLock(jobId) {
1028
1029
  await this.pool.query(
1029
1030
  `UPDATE qjw_jobs
1030
- SET lock_id = NULL, lock_expires_at = NULL, updated_at = NOW(3)
1031
+ SET lock_id = NULL, lock_expires_at = NOW(3), updated_at = NOW(3)
1031
1032
  WHERE id = ?`,
1032
1033
  [jobId]
1033
1034
  );
@@ -1902,9 +1903,10 @@ var InMemoryStorageAdapter = class {
1902
1903
  async releaseLock(jobId) {
1903
1904
  const job = this.jobs.get(jobId);
1904
1905
  if (!job) return;
1906
+ const now = (/* @__PURE__ */ new Date()).toISOString();
1905
1907
  job.lockId = null;
1906
- job.lockExpiresAt = null;
1907
- job.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
1908
+ job.lockExpiresAt = now;
1909
+ job.updatedAt = now;
1908
1910
  }
1909
1911
  // -------------------------------------------------------------------------
1910
1912
  // Recover stalled jobs