micro-fan / aiozk

Asyncio client for zookeeper
MIT License
49 stars 20 forks source link

Cancel pending tasks waiting for session loss after lock is released. #36

Closed rhdxmr closed 5 years ago

rhdxmr commented 5 years ago

Everytime lock is acquired by calling this statement "async with zk.recipes.Lock(path).acquire():", a task is created waiting for zookeeper session loss. However that task is still pending after the lock is released. If a daemon program keeps zookeeper session over a month while it is running, there exist tons of pending tasks and it leads to resource leakage problem.

cybergrind commented 5 years ago

@rhdxmr that's great but it would be nice to have some tests for this behavior, can you do that?

rhdxmr commented 5 years ago

@cybergrind OK. I will try :^)

rhdxmr commented 5 years ago

Hello @cybergrind :smiley: I added some test code relevant with this pr. Can you review my code?

cybergrind commented 5 years ago

hi @rhdxmr ! everything looks great now, thank you for your fascinating work and time! Release this in 0.17.0