You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With aioetcd==0.4.5.0 I can't seem to get working Locks. This is my first version of usage so I'm not sure I can't speak to if this ever worked.
If I have two processes both which try to aquire the same lock with this code:
import asyncio
import os
import time
import aio_etcd as etcd
from aio_etcd.lock import Lock
client = etcd.Client()
async def some_coroutine():
async with Lock(client, 'mylock') as my_lock:
print('lock_acquired in pid {pid}'.format(pid=os.getpid()))
time.sleep(10)
print('lock_released in pid {pid}'.format(pid=os.getpid()))
loop = asyncio.get_event_loop()
loop.run_until_complete(some_coroutine())
OK then I run the code in parallel using two terminals each running python3 foo.py immediately after each other. If locking is working I expect to see something like this:
PID 1 acquire the lock
# 10 seconds pass
PID 1 release the lock
PID 2 acquire the lock
# 10 seconds pass
PID 2 release the lock
Instead I see something like this:
PID 1 acquire the lock
PID 2 acquire the lock
# 10 seconds pass
PID 1 release the lock
PID 2 release the lock
Does this work for others users?
Am I doing this wrong?
Any insight into how to fix, I could send a PR with a little guidance.
The text was updated successfully, but these errors were encountered:
With
aioetcd==0.4.5.0
I can't seem to get working Locks. This is my first version of usage so I'm not sure I can't speak to if this ever worked.If I have two processes both which try to aquire the same lock with this code:
OK then I run the code in parallel using two terminals each running
python3 foo.py
immediately after each other. If locking is working I expect to see something like this:Instead I see something like this:
Does this work for others users?
Am I doing this wrong?
Any insight into how to fix, I could send a PR with a little guidance.
The text was updated successfully, but these errors were encountered: