Is my method of use wrong?
See original GitHub issueimport asyncio
from aioredlock import Aioredlock, LockError, Sentinel
redis_instances = [('10.5.208.20',6379)]
lock_manager = Aioredlock(redis_instances)
lock_manager.retry_count = 10
async def get_lock():
try:
async with await lock_manager.lock("resource_name") as lock:
print(lock.valid)
except LockError as e:
print("Lock not acquired")
async def main():
tasks = [asyncio.create_task(get_lock()) for i in range(10)]
await asyncio.wait(tasks)
asyncio.run(main())
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top Results From Across the Web
Java Beginner - What is wrong with my method?
In java you don't declare methods in methods. Change that to public String critMeth(String name){ String c = name + " loves you!...
Read more >using the wrong method | English examples in context
High quality example sentences with “using the wrong method” in context from reliable sources - Ludwig is the linguistic search engine that helps...
Read more >Error of the method: what is it for? - PMC - NCBI
The casual error, also known as random error, occurs due to the difficulty and/or inaccuracy in either identifying or defining certain points.
Read more >PDE IVP - Characteristics, why is my method wrong?
Using the initial condition, we find that A(x)=sinx so that u(x,t)=t+sinx. But this is not the correct solution and I have not used...
Read more >9 Words and Phrases You're Probably Using Wrong
Here's a primer on how to use (or not use) nine words and phrases common in ... Sure, saying the wrong word (usually)...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks.
No problem If you want to reuse the connection, you can instantiate a connection pool from aioredis first, and then pass that in as your instance, and that will allow you to reuse the connection pool.
This isn’t the best example, because it kind of just depends on class properties to make sure they don’t get used a second time. But it works as an example.