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

shared mongodb with multiple masters that only watch for certain jobs? #8

Open
aon108 opened this issue Apr 19, 2021 · 3 comments
Open
Labels
enhancement New feature or request

Comments

@aon108
Copy link

aon108 commented Apr 19, 2021

Is there a way to configure the Master server to watch only specific jobs on a shared mongodb queue from multiple apps so that you can have multiple master servers doing different things?

@nathanschwarz
Copy link
Owner

right now no, but it's something that will be introduced in later versions.
I'll try to update when I can.

I gave an advise about this use case in the README : you should have 1 app dedicated to handling all the tasks.

@aon108
Copy link
Author

aon108 commented Apr 20, 2021

I did check out all of the README and was thinking that I could just define a unique taskmap for each Master and they wont try run each others jobs but looking at the code I think this change might get the functionality working, what do you think?

  • In the taskQueue.js where it pulls the jobs from the mongodb this.pull
  • adding the mongodb query filter to only return the tasks that are found inside the taskMap
const taskTypes = _.pluck(this.taskMap,"taskType");
return this.rawCollection().findOneAndUpdate({ taskType: taskTypes, onGoing: false, dueDate: { $lte: new Date() }}, { $set: { onGoing: true }}, { sort: { priority: -1, createdAt: 1, dueDate: 1 }})

and of course update the jobs counts with the same taskType filter line 93

@nathanschwarz
Copy link
Owner

nathanschwarz commented Apr 20, 2021 via email

@nathanschwarz nathanschwarz added the enhancement New feature or request label Mar 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants