-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for idempotent enqueues
- Loading branch information
1 parent
a96c9b5
commit 3687c0c
Showing
11 changed files
with
226 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
"name": "liteque", | ||
"description": "A sqlite-based job queue for Node.js", | ||
"author": "Mohamed Bassem <[email protected]>", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"type": "module", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
|
@@ -32,7 +32,7 @@ | |
"devDependencies": { | ||
"@tsconfig/node21": "^21.0.3", | ||
"@types/better-sqlite3": "^7.6.11", | ||
"drizzle-kit": "^0.20.14", | ||
"drizzle-kit": "^0.24.02", | ||
"typescript": "^5.6.3", | ||
"vitest": "^1.3.1" | ||
}, | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ALTER TABLE `tasks` ADD `idempotencyKey` text;--> statement-breakpoint | ||
CREATE UNIQUE INDEX `tasks_queue_idempotencyKey_unique` ON `tasks` (`queue`,`idempotencyKey`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
{ | ||
"version": "6", | ||
"dialect": "sqlite", | ||
"id": "0f918c72-5b27-4e4c-9027-631ead290bf2", | ||
"prevId": "3094773c-0138-46b2-b617-4b10093b0f53", | ||
"tables": { | ||
"tasks": { | ||
"name": "tasks", | ||
"columns": { | ||
"id": { | ||
"name": "id", | ||
"type": "integer", | ||
"primaryKey": true, | ||
"notNull": true, | ||
"autoincrement": true | ||
}, | ||
"queue": { | ||
"name": "queue", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
}, | ||
"payload": { | ||
"name": "payload", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
}, | ||
"createdAt": { | ||
"name": "createdAt", | ||
"type": "integer", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
}, | ||
"status": { | ||
"name": "status", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false, | ||
"default": "'pending'" | ||
}, | ||
"expireAt": { | ||
"name": "expireAt", | ||
"type": "integer", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"autoincrement": false | ||
}, | ||
"allocationId": { | ||
"name": "allocationId", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
}, | ||
"numRunsLeft": { | ||
"name": "numRunsLeft", | ||
"type": "integer", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
}, | ||
"maxNumRuns": { | ||
"name": "maxNumRuns", | ||
"type": "integer", | ||
"primaryKey": false, | ||
"notNull": true, | ||
"autoincrement": false | ||
}, | ||
"idempotencyKey": { | ||
"name": "idempotencyKey", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"autoincrement": false | ||
} | ||
}, | ||
"indexes": { | ||
"tasks_queue_idx": { | ||
"name": "tasks_queue_idx", | ||
"columns": [ | ||
"queue" | ||
], | ||
"isUnique": false | ||
}, | ||
"tasks_status_idx": { | ||
"name": "tasks_status_idx", | ||
"columns": [ | ||
"status" | ||
], | ||
"isUnique": false | ||
}, | ||
"tasks_expire_at_idx": { | ||
"name": "tasks_expire_at_idx", | ||
"columns": [ | ||
"expireAt" | ||
], | ||
"isUnique": false | ||
}, | ||
"tasks_num_runs_left_idx": { | ||
"name": "tasks_num_runs_left_idx", | ||
"columns": [ | ||
"numRunsLeft" | ||
], | ||
"isUnique": false | ||
}, | ||
"tasks_max_num_runs_idx": { | ||
"name": "tasks_max_num_runs_idx", | ||
"columns": [ | ||
"maxNumRuns" | ||
], | ||
"isUnique": false | ||
}, | ||
"tasks_allocation_id_idx": { | ||
"name": "tasks_allocation_id_idx", | ||
"columns": [ | ||
"allocationId" | ||
], | ||
"isUnique": false | ||
}, | ||
"tasks_queue_idempotencyKey_unique": { | ||
"name": "tasks_queue_idempotencyKey_unique", | ||
"columns": [ | ||
"queue", | ||
"idempotencyKey" | ||
], | ||
"isUnique": true | ||
} | ||
}, | ||
"foreignKeys": {}, | ||
"compositePrimaryKeys": {}, | ||
"uniqueConstraints": {} | ||
} | ||
}, | ||
"enums": {}, | ||
"_meta": { | ||
"schemas": {}, | ||
"tables": {}, | ||
"columns": {} | ||
}, | ||
"internal": { | ||
"indexes": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters