Пример #1
0
	worker.succeed = function (job) {
	    redis.incr (key ('stat', 'processed'), function () {
		redis.incr (
		    key ('stat', 'processed', worker.identifier)
		    , function () { process.nextTick (poll) }
		)
	    })
	}
Пример #2
0
	worker.fail = function (job, failure) {
	    var failure = failure || {}
	    redis.rpush (
		key ('failed')
		, JSON.stringify ({
		    worker: worker.identifier
		    , error: failure.error || 'unspecified'
		    , queue : worker.queue
		    , payload: job
		    , exception: failure.exception || 'generic'
		    , backtrace: failure.backtrace || ['unknown']
		    , failed_at: (new Date ()).toString ()
		})
	    )

	    redis.incr (key ('stat', 'failed'))
	    redis.incr (key ('stat', 'failed', worker.identifier))
	    process.nextTick (poll)
	}
Пример #3
0
 details.urls.forEach(function(url) {
     // set a redis key to quickly count the occurences
     redis.incr(url, function(err, val) {
         var data = {
             "url": url,
             "count": val
         };
         // slap the record in our DB or update it if it exists
         collection.update({url: url}, {$set: data}, {upsert:true});
     });
 });