grantcarthew / node-rethinkdb-job-queue

A persistent job or task queue backed by RethinkDB.
https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki
MIT License
156 stars 16 forks source link

delayed tasks not running #83

Closed sagivf closed 6 years ago

sagivf commented 6 years ago

Hey @grantcarthew I know your not actively developing but I realy hope you can help me out on this issue.

I have a single node instance with single queues that have delayed tasks. They seem not to be running even thought the dateEnabled has past and i'm not quite sure why.

First is seems like that without setting a concurrency level on the queue, the jobs didn't run unless there where not a part of the masterInterval review process.

After that it seems like only jobs that have a highest priority set are running...

Can you point me in the right direction as why delayed jobs would not run?

grantcarthew commented 6 years ago

What are the options your using @sagivf

Ref: https://github.com/grantcarthew/node-rethinkdb-job-queue/wiki/Queue-Master#delayed-job-processing

sagivf commented 6 years ago

I saw that, yes, that is part of the issue, the queue isn't busy and the review isn't properly starting the jobs.

Basically there seem to be two problems: 1) Originally the Queue properties where only

{
 name: 'lesson_reminder',
masterInterval: 1000 * 20
}

and the jobs

 retryMax: 2,
 retryDelay: 200000,
 dateEnable,
name: `${lessonId}:reminder`,
data: {
  lessonId,
  type: reminderType,
  time: reminderTime
}

And although I saw the state documents timestamp was being updated, the jobs never started processing. Once I set the concurrency to 10 it started working. This happened locally to, so I can recreate it if you want.

2) After that I decided to set one job type priority to 'highest' and the rest to 'high' and while this worked locally, In production for some reason only the highest job was getting processed. This was pretty consistent. After I changed all the jobs to highest everything was back to normal.

Any guesses?

sagivf commented 6 years ago

Unrelated, but how does debugging work? I added DEBUG=true to the environment, but didn't see anything outputted to the console.

grantcarthew commented 6 years ago

The debug logs are written using this: https://www.npmjs.com/package/debug

I'm using perj for logging going forward but if I remember correctly you need to set the DEBUG env var to the module name you want to display logs for or *.

I don't even have RethinkDB or Docker installed at the moment @sagivf. If you are happy to debug it I'll help were I can.

I recon the queue-process.js restart call is the place to start debugging. This gets called by db-review.js.

grantcarthew commented 6 years ago

Do you use Signal?

sagivf commented 6 years ago

I installed it - is it safe? I'll start with debugging what I was able to recreate locally with the concurrency level not being set.

grantcarthew commented 6 years ago

Send me an email with first name at last name dot net and I'll send you my phone number for Signal contact. Or send my your number.

sagivf commented 6 years ago

I send you an email.

I tried recreating my initial issue locally and now it's working... I'll close the issue and will keep an eye out for the issue, since everything is time based it's kind of hard to recreate. Thanks, I'm slowly getting to know this project more and more, so I hope I can be more active soon...