-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Implement locks for RedisCluster #2013
Changes from all commits
e06d0a5
3cad16f
2ec6df5
bb6b9e6
6979ea3
f2341bc
d9fa1b2
53ae580
50d1b9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -180,7 +180,7 @@ def acquire(self, blocking=None, blocking_timeout=None, token=None): | |
if token is None: | ||
token = uuid.uuid1().hex.encode() | ||
else: | ||
encoder = self.redis.connection_pool.get_encoder() | ||
encoder = self.redis.get_encoder() | ||
token = encoder.encode(token) | ||
if blocking is None: | ||
blocking = self.blocking | ||
|
@@ -224,7 +224,7 @@ def owned(self): | |
# need to always compare bytes to bytes | ||
# TODO: this can be simplified when the context manager is finished | ||
if stored_token and not isinstance(stored_token, bytes): | ||
encoder = self.redis.connection_pool.get_encoder() | ||
encoder = self.redis.get_encoder() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm beginning to confuse myself a bit -- I think this is a safe change since both redis classes have the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you're right. Since merging in cluster and asyncio, we actually need to start cleaning and unifying these interfaces. There's a lot of duplication - but the philosophy was first get it in, then clean it up. |
||
stored_token = encoder.encode(stored_token) | ||
return self.local.token is not None and stored_token == self.local.token | ||
|
||
|
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.
sorry for these whitespace trims -- my IDE does it 😅
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.
flake8 actually enforces it, but only on python files ;)