-
Notifications
You must be signed in to change notification settings - Fork 5
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
extraction-worker should parallelize different root domains #19
Comments
better-queue has a priority function that can inform order: https://github.com/diamondio/better-queue#filtering-validation-and-priority |
Thinking out loud: We can give each task a random priority out of 5. |
Yeah, randomizing all incoming request could be a good parallelization strategy for now that doesn't require lots of other effort. Good idea, let's test this. |
I tried this out and it didn't work. for some reason the order didn't change. this statement is based on the fact that the order in which the files were written to data was the same. if the messages are executed in random order i expect the data to be written random order. also if the range of priority was big like 50 then i started getting a strange error. i will try it out later again. |
weird. But I'd have to see code to comment meaningfully. |
Here's the code. The only change I did was in extraction-worker/src/worker.mjs. export function run() {
log(
`Starting as worker thread with queue options: "${JSON.stringify(
workerData.queue.options
)}`
);
const queue = new Queue(messages.route, {
...workerData.queue.options,
priority: function (message, cb) {
const pr = Math.floor(Math.random() * 1000)
cb(null, pr);
},
});
queue.on("task_finish", loggingProxy(queue, reply));
queue.on("task_failed", loggingProxy(queue, panic));
parentPort.on("message", messageHandler(queue));
return queue;
} |
I've cross-checked this with the better-queue docs and to me it looks correct. |
The text was updated successfully, but these errors were encountered: