Skip to content

Commit

Permalink
Merge pull request #855 from hockeytim11/master
Browse files Browse the repository at this point in the history
Converting Job ids back into integers
  • Loading branch information
behrad committed May 13, 2016
2 parents 0a088e3 + da3f2ac commit ab5299c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/redis.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ exports.configureFactory = function( options, queue ) {
// Parse out original ID from zid
client.stripFIFO = function( zid ) {
if ( typeof zid === 'string' ) {
return zid.substr(zid.indexOf('|')+1);
return +zid.substr(zid.indexOf('|')+1);
} else {
// Sometimes this gets called with an undefined
// it seems to be OK to have that not resolve to an id
Expand Down
2 changes: 1 addition & 1 deletion test/tdd/redis.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ describe('redis', function() {
it('should strip the prefix on the id', function () {
var client = redis.createClient();
var id = client.stripFIFO( '03|123' );
id.should.equal('123');
id.should.equal(123);
});
});

Expand Down
6 changes: 3 additions & 3 deletions test/test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ describe 'Kue Tests', ->
jobs.process 'email-to-be-completed', (job, jdone)->
jdone( null, { prop: 'val' } )
jobs.on 'job complete', (id, result) ->
id.should.be.equal testJob.id+''
id.should.be.equal testJob.id
result.prop.should.be.equal 'val'
done()
job_data =
Expand All @@ -154,12 +154,12 @@ describe 'Kue Tests', ->
title: 'Test Email Job'
to: 'tj@learnboost.com'
jobs.on 'job failed attempt', (id, errMsg, doneAttempts) ->
id.should.be.equal newJob.id+''
id.should.be.equal newJob.id
errMsg.should.be.equal errorMsg
doneAttempts.should.be.equal 1
total--
.on 'job failed', (id, errMsg)->
id.should.be.equal newJob.id+''
id.should.be.equal newJob.id
errMsg.should.be.equal errorMsg
(--total).should.be.equal 0
done()
Expand Down

0 comments on commit ab5299c

Please sign in to comment.