Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

lock.is_owner() does not work #8

Open
ricpruss opened this issue Mar 15, 2021 · 0 comments
Open

lock.is_owner() does not work #8

ricpruss opened this issue Mar 15, 2021 · 0 comments

Comments

@ricpruss
Copy link

Looking at the cause for this.
await self.pool_or_conn.get(self.key) returns a string
and self._token.encode() is a b''

The fix is to drop the .encode() i.e new code is.
async def is_owner(self) -> bool:
"""Determine if the instance is the owner of the lock"""
return (
await self.pool_or_conn.get(self.key)
) == self._token # pylint: disable=no-member

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant