Skip to content

Commit

Permalink
BF #17
Browse files Browse the repository at this point in the history
  • Loading branch information
veny committed Aug 24, 2014
1 parent 0d849c0 commit 821f185
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/gearmanode/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ Client.prototype.submitJob = function(name, payload, options) {
} else {
jobServer.jobsWaiting4Created.push(job); // add to queue of submited jobs waiting for confirmation
job.jobServerUid = jobServer.getUid(); // store job server UID on job to later usage
job.emit('submited');
process.nextTick(function() { job.emit('submited'); });
Client.logger.log('debug', 'job submited, name=%s, unique=%s', job.name, job.unique);
}
}
Expand Down
1 change: 1 addition & 0 deletions lib/gearmanode/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@


exports.VERSION_HISTORY = [
['0.1.8', '2014-24-08', 'Enh #16, BF #17'],
['0.1.7', '2014-14-07', 'BF #14'],
['0.1.6', '2014-17-06', 'BF #13'],
['0.1.5', '2014-20-03', 'added SET_CLIENT_ID; integration with Travis CI; BF #9'],
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": "gearmanode",
"version": "0.1.7",
"version": "0.1.8",
"description": "Node.js library for the Gearman distributed job system with support for multiple servers",
"keywords": ["gearman", "distributed", "message queue", "job", "worker"],
"author": "Vaclav Sykora <[email protected]>",
Expand Down
12 changes: 11 additions & 1 deletion test/test-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ describe('Client', function() {
c.submitJob('reverse').should.be.an.instanceof(Error);
})
it('should emit `submited` if job sent to server', function(done) {
js = c.jobServers[0];
var job = c.submitJob('reverse', 'hi');
js.jobsWaiting4Created.length.should.equal(0);
job.once('submited', function() {
Expand All @@ -102,6 +101,17 @@ describe('Client', function() {
done();
})
})
it('should emit `submited` when job server already connected (BF #17)', function(done) {
js.connect(function() {
var job = c.submitJob('reverse', 'hi');
job.once('submited', function() {
job.jobServerUid.should.equal(js.getUid());
job.processing.should.be.true;
done();
});
});

})
})


Expand Down

0 comments on commit 821f185

Please sign in to comment.