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

Use pipelines to to make more transactional actions #750

Merged
merged 1 commit into from
Jan 24, 2022

Conversation

evantahler
Copy link
Member

Specifically, when removing a stuck worker (queue.forceCleanWorker()) it was possible to only do part of the cleanup if the redis server or the node process had a problem in the middle of the method.

@evantahler evantahler added the bug label Jan 24, 2022
Comment on lines +487 to +495
const pipeline = this.connection.redis
.multi()
.incr(this.connection.key("stat", "failed"))
.del(this.connection.key("stat", "failed", workerName))
.del(this.connection.key("stat", "processed", workerName))
.del(this.connection.key("worker", "ping", workerName))
.del(this.connection.key("worker", workerName, queues, "started"))
.del(this.connection.key("worker", workerName))
.srem(this.connection.key("workers"), workerName + ":" + queues);
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the main enhancement - This method will now either remove all or none of the worker's data. no more partial deletes.

@evantahler evantahler merged commit 7249b9d into main Jan 24, 2022
@evantahler evantahler deleted the pipeline-force-clean-worker branch January 24, 2022 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant