-
Notifications
You must be signed in to change notification settings - Fork 132
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
fix disabling of distributed lock (#2) #109
base: master
Are you sure you want to change the base?
Conversation
Addresses #101 |
@sibson, please let me know if there is anything I can do/change here to help move this along. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change is good but I'm struggling with understanding the semantics of has_value vs present. I understand one is converting None to default and the other preserves None but something in the naming isn't clicking in my head. Perhaps, adding a docstring to each to better describe their behaviour would help?
|
||
def test_disable_lock_key_3(self): | ||
self.app.conf.REDBEAT_LOCK_KEY = None | ||
self.assertTrue("REDBEAT_LOCK_KEY" in self.app.conf.keys()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary? It seems to be testing the assignment we did in the previous line or am I missing some behind the scenes magic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes. I'll remove this.
self.assertTrue("redbeat_lock_key" in self.app.conf.keys()) | ||
self.conf = RedBeatConfig(self.app) | ||
self.assertEqual(self.conf.lock_key, None) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a @pytest.mark.skipif(CELERY_4_OR_GREATER, reason="requires Celery < 4.x")
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. Will add the skipif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've dropped celery 3 support so this maybe simpler to fix.
@@ -21,6 +21,24 @@ def test_lock_timeout(self): | |||
def test_key_prefix_default(self): | |||
self.assertEqual(self.conf.key_prefix, 'redbeat:') | |||
|
|||
def test_lock_key_default(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To check my understanding, is this the same test as in https://github.com/sibson/redbeat/pull/109/files#diff-423890b7e3c2aa4791f9e203b7f194cbR45? If so I don't think we need to remove it, being explicit here is great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this tests the same thing and was added to be explicit.
self.assertTrue("REDBEAT_LOCK_KEY" in self.app.conf.keys()) | ||
self.conf = RedBeatConfig(self.app) | ||
self.assertEqual(self.conf.lock_key, None) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a test_custom_lock_key()
or is that covered elsewhere somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. I'll add a test for a custom lock key.
return self.app.conf.first(name, name.upper()) or default | ||
|
||
def key_present_or(self, name, default=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be tests for this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely. I'll add one.
@sibson @bertosantamaria Any new on this? Can I help? This feature is really needed and currently not working. |
Looking at the comment history, this was close to being good to go just needed a few changes and now it has conflicts. If you'd like to start a new PR too address the feedback we could get it merged in favor of this. |
No description provided.