Closed rkrell closed 2 months ago
Just for comparison, the following code works instead:
import asyncio
from cashews import cache
async def main():
cache.setup('mem://')
redis_backend = cache.setup(
f'redis://127.0.0.1:6379/0',
password=None,
retry_on_timeout=True,
prefix='redis',
protocol=3
)
try:
async with cache.lock('redis:shower', expire=10):
print(
f"shower is "
f"{'occupied' if await cache.is_locked('redis:shower') else 'available'}")
print(
f"shower is "
f"{'occupied' if await cache.is_locked('redis:shower') else 'available'}")
finally:
await redis_backend.close()
if __name__ == '__main__':
try:
asyncio.run(main(), debug=True)
except KeyboardInterrupt:
print('Cancelled by user')
I got to call close()
on single Backend
instances.
As soon as I call just await cache.close()
the problem appears.
@rkrell Thanks for reporting. I will take a look at this (probably a bug) at weekends
Sorry for a delay , the fix in the main branch. Gonna to release it soon
Fixed with 7.1.0 version. Please reopen the issue if it still exist
cashews==7.0.2
Example code:
results in a stacktrace:
Shouldn't this be handled differently?