Skip to content
Browse files

Return the created ID when pushing to a queue

  • Loading branch information...
1 parent de3bd49 commit 59c8a19de486bb7d7af2571311e0bab038246cf0 @tim-smart tim-smart committed Feb 21, 2011
Showing with 5 additions and 1 deletion.
  1. +5 −1 index.js
View
6 index.js
@@ -61,9 +61,11 @@ exports.Queue = Queue;
Queue.prototype.push = function (payload, callback) {
var self = this;
+ var id = uuid();
+
// Push the job.
self.client.rpush(self.prefix + 'queue:' + self.name, JSON.stringify({
- id: uuid(),
+ id: id,
payload: payload,
error_count: 0,
errors: [],
@@ -75,6 +77,8 @@ Queue.prototype.push = function (payload, callback) {
if (callback) callback(null, id);
});
+
+ return id;
};

0 comments on commit 59c8a19

Please sign in to comment.
Something went wrong with that request. Please try again.