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/CHANGELOG.md +122 -76
- package/README.md +7 -1
- package/dist/core/worker.d.ts.map +1 -1
- package/dist/index.cjs +8 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/storage/in-memory.adapter.d.ts.map +1 -1
- package/dist/storage/mysql.adapter.d.ts.map +1 -1
- package/dist/storage/postgres.adapter.d.ts.map +1 -1
- package/dist/storage/redis.adapter.d.ts.map +1 -1
- package/package.json +1 -1
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:
|
|
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 =
|
|
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 =
|
|
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 =
|
|
1907
|
-
job.updatedAt =
|
|
1908
|
+
job.lockExpiresAt = now;
|
|
1909
|
+
job.updatedAt = now;
|
|
1908
1910
|
}
|
|
1909
1911
|
// -------------------------------------------------------------------------
|
|
1910
1912
|
// Recover stalled jobs
|