aioredis-lock icon indicating copy to clipboard operation
aioredis-lock copied to clipboard

lock.is_owner() does not work

Open ricpruss opened this issue 3 years ago • 0 comments

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

ricpruss avatar Mar 15 '21 02:03 ricpruss