Skip to content

Commit 2822f74

Browse files
committed
🗃 Remove visible when acking jobs
This is a non-breaking change that forms part of the migration path to improving our performance in #15 When acking a job, we now unset the `visible` property, which makes `visible` and `deleted` mutually exclusive properties, so that the presence of one implies the absence of the other. We can do this, because the only time we query on `visible` is when we *also* query for `deleted: {$exists: false}`. Similarly, the only times we query for `deleted: {$exists: true}` are times when we don't query `visible`.
1 parent edc03cb commit 2822f74

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎mongodb-queue.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ export class MongoDBQueue<T = any> {
208208
$set: {
209209
deleted: now(),
210210
},
211+
$unset: {
212+
visible: 1,
213+
},
211214
};
212215
const options = {
213216
returnDocument: 'after',

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@reedsy/mongodb-queue",
3-
"version": "7.1.0",
3+
"version": "7.1.1",
44
"description": "Message queues which uses MongoDB.",
55
"main": "mongodb-queue.js",
66
"scripts": {

0 commit comments

Comments
 (0)