Skip to content

Commit

Permalink
Version 0.2.0 (add update/remove methods)
Browse files Browse the repository at this point in the history
  • Loading branch information
wonderlic-stephene authored and serisman committed Apr 24, 2019
1 parent b649d16 commit cb193a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
16 changes: 6 additions & 10 deletions lib/message-queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function MessageQueue() {
.then(function(status) {
switch (status) {
case "Completed":
return _removeById(queueItem._id);
return _removeOneById(queueItem._id);
case "Retry":
return _release(queueItem);
case "Rejected":
Expand All @@ -148,10 +148,8 @@ function MessageQueue() {
});
}

function _removeById(id) {
var query = {_id: id};

return _remove(query);
function _removeOneById(id) {
return _remove({_id: id});
}

function _remove(query, multi) {
Expand All @@ -169,10 +167,8 @@ function MessageQueue() {
});
}

function _updateById(id, update) {
var query = {_id: id};

return _update(query, update);
function _updateOneById(id, update) {
return _update({_id: id}, update);
}

function _update(query, update, multi) {
Expand Down Expand Up @@ -209,7 +205,7 @@ function MessageQueue() {
}
};

return _updateById(queueItem._id, update);
return _updateOneById(queueItem._id, update);
}

function _reject(queueItem) {
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": "mongo-message-queue",
"version": "0.1.4",
"version": "0.2.0",
"description": "A promise based message queue for Node.js using a mongodb backing store.",
"main": "index.js",
"dependencies": {
Expand Down

0 comments on commit cb193a6

Please sign in to comment.