mpneuried / rsmq-worker

Helper to simply implement a worker around RSMQ ( Redis Simple Message Queue )
MIT License
117 stars 24 forks source link

invisibletime in options-object #22

Open groenlid opened 8 years ago

groenlid commented 8 years ago

In my code, I'm currently trying to create a new queue if necessary and start processing messages using the rsmq-worker package. The worker is doing time-consuming work so I want the timeout and invisibletime to be a high number.

const timeToProcessMessage = 600000
const worker = new RSMQWorker(queueName, {
  timeout: timeToProcessMessage,
  invisibletime: timeToProcessMessage
})
worker.start()

This command seem to create the queue, but with the wrong invisible-value. It seems to set the default 30sek value instead of the value in the options-object.

mpneuried commented 8 years ago

I will try to have a look at it tomorrow...

mpneuried commented 8 years ago

After my tests it's working well. But i think you missed something in the docs. The unit of the timeout is ms and for invisibletime it's s. So you're using 10 minutes timeout and 6,94 days invisibility.

The Setting timeout is used inside rsmq-worker to define a time a single process/messgae is allowed to run. The invisibletime configuration is the time a message will be invisible for all workers after it was once received. This is required to prevent a message to be processed by mutliple workers in parallel.

I hope this clears your case.