Skip to content

Loading…

Job get #135

Merged
merged 3 commits into from

2 participants

@scinos

Add method to get job 'keys' (i.e. the opposite to Job.prototype.set())

@tj tj commented on an outdated diff
lib/queue/job.js
@@ -307,6 +307,20 @@ Job.prototype.set = function(key, val, fn){
};
/**
+ * Get job `key`
+ *
+ * @param {String} key
+ * @param {String} fn
+ * @return {Job} for chaining
+ * @api public
+ */
+
+Job.prototype.get = function(key, fn){
+ this.client.hget('q:job:' + this.id, key, fn || noop);
+ return this;
@tj
tj added a note

2 space indents

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@scinos

Fixed, my bad

@tj tj merged commit d1c1a93 into Automattic:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 30, 2012
  1. @scinos

    Merge pull request #1 from LearnBoost/master

    scinos committed
    test
  2. @scinos
Commits on Oct 1, 2012
  1. @scinos
Showing with 14 additions and 0 deletions.
  1. +14 −0 lib/queue/job.js
View
14 lib/queue/job.js
@@ -307,6 +307,20 @@ Job.prototype.set = function(key, val, fn){
};
/**
+ * Get job `key`
+ *
+ * @param {String} key
+ * @param {String} fn
+ * @return {Job} for chaining
+ * @api public
+ */
+
+Job.prototype.get = function(key, fn){
+ this.client.hget('q:job:' + this.id, key, fn || noop);
+ return this;
+};
+
+/**
* Set the job progress by telling the job
* how `complete` it is relative to `total`.
*
Something went wrong with that request. Please try again.