joanvila/aioredlock

Update aioredlock to work with aioredis-1.0

Closed this issue · 5 comments

Provided example desn't work for me.

`--> python ./examples/basic_lock.py 
Traceback (most recent call last):                                                                                                            
  File "./basic_lock.py", line 24, in <module>                                                                                                
    loop.run_until_complete(basic_lock())                                                                                                     
  File "/usr/lib/python3.6/asyncio/base_events.py", line 467, in run_until_complete                                                           
    return future.result()                                                                                                                    
  File "./basic_lock.py", line 11, in basic_lock                                                                                              
    lock = await lock_manager.lock("resource")                                                                                                
  File "/home/ildar/slivoglot-2/aioredlock/aioredlock/algorithm.py", line 51, in lock                                                         
    locked, elapsed_time = await self.redis.set_lock(resource, lock_identifier)                                                               
  File "/home/ildar/slivoglot-2/aioredlock/aioredlock/redis.py", line 53, in set_lock                                                         
    success = await self._lock_single_instance(instance, resource, lock_identifier)                                                           
  File "/home/ildar/slivoglot-2/aioredlock/aioredlock/redis.py", line 64, in _lock_single_instance                                            
    return await connection.set(                                                                                                              
AttributeError: 'RedisConnection' object has no attribute 'set'  

Ok, seems like aioredlock requires aioredis-0.3 but I have 1.0.

I would like to try to update aioredlock to work with aioredis-1.0.

Yes, I had this in my backlog but didn't have time. I've put a comment in the PR

PR is merged

One more problem. Coverage not 100% with this PR.

PR is merged.