Skip to content

Commit

Permalink
Merge pull request #14 from reedsy/object-id-ack
Browse files Browse the repository at this point in the history
🗃 Change `ack` to (string) `ObjectId`
  • Loading branch information
alecgibson authored Dec 4, 2024
2 parents 8d04c21 + a2a51bd commit edc03cb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions mongodb-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@
*
**/

import {randomBytes} from 'crypto';
import {Collection, Db, Filter, FindOneAndUpdateOptions, Sort, UpdateFilter, WithId} from 'mongodb';

function id(): string {
return randomBytes(16).toString('hex');
}
import {Collection, Db, Filter, FindOneAndUpdateOptions, ObjectId, Sort, UpdateFilter, WithId} from 'mongodb';

function now(): string {
return (new Date()).toISOString();
Expand Down Expand Up @@ -135,7 +130,7 @@ export class MongoDBQueue<T = any> {
const update: UpdateFilter<Message<T>> = {
$inc: {tries: 1},
$set: {
ack: id(),
ack: new ObjectId().toHexString(),
visible: nowPlusSecs(visibility),
},
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reedsy/mongodb-queue",
"version": "7.0.1",
"version": "7.1.0",
"description": "Message queues which uses MongoDB.",
"main": "mongodb-queue.js",
"scripts": {
Expand Down

0 comments on commit edc03cb

Please sign in to comment.