Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pass object in message event #47 #48

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _src/lib/rsmq-worker.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions _src/test/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand All @@ -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 )
Expand All @@ -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)
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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

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": "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",
Expand Down