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

using uuid-$hostname-$pid replace default uuid as lock token. #217

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

pengwk
Copy link

@pengwk pengwk commented Apr 26, 2022

We run multiple redbeat instances for high availability, and sometimes we find that the service is not behaving as expected, we want to know which server is running, but it's hard to know right now, so we want to use uuid-$hostname-$pid as a lock token to aid troubleshooting.

@pengwk
Copy link
Author

pengwk commented May 4, 2022

@sibson Do you have time to look at this pull request? We'd like to use this feature as soon as possible. Many thanks!

@sibson
Copy link
Owner

sibson commented May 5, 2022

This seems like a good idea. If I'm understanding it correctly it means we're sticking machine identifying information into redis. I don't see any obvious problems with that but thought I'd mention in case someone sees an issue with doing so. It looks like there are some lint errors, if you clean those up and no one objects I'll merge.

@pengwk
Copy link
Author

pengwk commented May 5, 2022

@sibson Lint errors already fixed, pls review.
Many thanks!

@pengwk
Copy link
Author

pengwk commented May 10, 2022

Can we merge now? @sibson

@pengwk
Copy link
Author

pengwk commented May 23, 2022

Is there a specific waiting time? We would like to know approximately when we can merge and release a new version

Many Thanks!

@pengwk
Copy link
Author

pengwk commented Jun 7, 2022

A month has passed and it looks like no one has voiced any objections, can we merge now? @sibson

Many Thanks!

@@ -163,13 +165,20 @@ def __init__(self, app=None):
self.schedule_key = self.key_prefix + ':schedule'
self.statics_key = self.key_prefix + ':statics'
self.lock_key = self.either_or('redbeat_lock_key', self.key_prefix + ':lock')
self.lock_token = self.generate_lock_token()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this token should be generated at acquire time to keep the same semantics we currently have. Also I would guess including the token in the info log below the acquire line would be good since ideally you would want to be able to check your logs to figure out which host has the lock rather than accessing redis for that information.

Ideally we'd also want to move towards using the stock redis-py Lock implementation since it now has a reacquire method that has the behaviour we're overriding extend with.

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.

3 participants