From a8b9a38fcccf4bae648a36092864c449b721c3ec Mon Sep 17 00:00:00 2001 From: rhonal chirinos Date: Thu, 16 May 2019 17:37:21 -0400 Subject: [PATCH 1/2] pass object in message event #47 --- _src/lib/rsmq-worker.coffee | 2 +- _src/test/main.coffee | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/_src/lib/rsmq-worker.coffee b/_src/lib/rsmq-worker.coffee index 9e764ac..ffd4feb 100644 --- a/_src/lib/rsmq-worker.coffee +++ b/_src/lib/rsmq-worker.coffee @@ -484,7 +484,7 @@ class RSMQWorker extends require( "mpbasic" )() @emit( "next" ) if _useInterval return try - @emit "message", msg.message, _fnNext, _id + @emit "message", msg, _fnNext, _id catch _err if not @listeners( "error" )?.length or @config.alwaysLogErrors @error "error", _err diff --git a/_src/test/main.coffee b/_src/test/main.coffee index 91548df..8097471 100644 --- a/_src/test/main.coffee +++ b/_src/test/main.coffee @@ -43,7 +43,7 @@ describe "----- rsmq-worker TESTS -----", -> _testFn = ( msg, next, id )-> - should.equal( msg, _examplemsg ) + should.equal( msg.message, _examplemsg ) next() worker.removeListener( "message", _testFn ) @@ -64,7 +64,7 @@ describe "----- rsmq-worker TESTS -----", -> @timeout( _delay*1.5*1000 ) _testFn = ( msg, next, id )-> - should.equal( msg, _examplemsg ) + should.equal( msg.message, _examplemsg ) next() worker.removeListener( "message", _testFn ) _diff = Math.round( ( Date.now() - _start )/1000 ) @@ -85,7 +85,7 @@ describe "----- rsmq-worker TESTS -----", -> @timeout( _delay*1.5*1000 ) _testFn = ( msg, next, id )-> - should.equal( msg, _examplemsg ) + should.equal( msg.message, _examplemsg ) next() _diff = Math.round( ( Date.now() - _start )/1000 ) _diff.should.be.above(_delay) @@ -124,8 +124,8 @@ describe "----- rsmq-worker TESTS -----", -> _idx = 0 _testFn = ( msg, next, id )-> - should.equal( msg, _examplemsgs[ _idx ] ) - + should.equal( msg.message, _examplemsgs[ _idx ] ) + if _idx is 0 # stop and wait to check the hidden size setTimeout( _runHiddenSize( next ), 1000 ) @@ -174,7 +174,7 @@ describe "----- rsmq-worker TESTS -----", -> _idx = 0 _testFn = ( msg, next, id )-> - should.equal( msg, _examplemsgs[ _idx ] ) + should.equal( msg.message, _examplemsgs[ _idx ] ) next() @@ -301,7 +301,7 @@ describe "----- rsmq-worker TESTS -----", -> _testFn = ( msg, next, id )-> idx++ if idx <= 1 - should.equal( msg, _examplemsg ) + should.equal( msg.message, _examplemsg ) worker.stop() worker.send _examplemsg2, 0, ( err )-> should.not.exist( err ) @@ -329,7 +329,7 @@ describe "----- rsmq-worker TESTS -----", -> it "test stop method - Pull #5 start", ( done )-> _testFn = ( msg, next, id )-> - should.equal( msg, _examplemsg2 ) + should.equal( msg.message, _examplemsg2 ) done() return From 0326b673050d6f09e9c20fd61ba1dec96ee27c14 Mon Sep 17 00:00:00 2001 From: rhonal chirinos Date: Thu, 16 May 2019 18:23:42 -0400 Subject: [PATCH 2/2] version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6f02de0..53e6403 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rsmq-worker", - "version": "0.5.2", + "version": "0.5.3", "description": "RSMQ helper to simply implement a worker around the message queue", "keywords": [], "homepage": "https://github.com/mpneuried/rsmq-worker",