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

perf(worker): use abort controller with stalledCheckTimer #2509

Closed
wants to merge 4 commits into from

Conversation

roggervalf
Copy link
Collaborator

@roggervalf roggervalf commented Apr 5, 2024

Draft

this.stalledCheckTimer = setTimeout(async () => {
await this.startStalledCheckTimer();
}, this.opts.stalledInterval);
const callback = async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit confused about using the same callback for the timeout as well as for the abort signal. I think abort should only do abort and nothing else.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but there is a slight difference, in the delay case the callback is actually a "cleanup" function, but here the callback is both cleanup and starting a new timer. So I think in this case it will be better to refactor to a "cleaup" function that can be used only for the abort signal, and that is also called inside the current callback.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I overlooked this, as I can see that we are cleaning the timer here https://github.com/taskforcesh/bullmq/blob/master/src/classes/worker.ts#L869

@roggervalf roggervalf closed this Apr 9, 2024
@roggervalf roggervalf deleted the abort-stalled branch April 9, 2024 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants