Commit 1119413
fix(recipe): conn hangs when TreeCache refreshing
The previous implementation of session watcher triggers blocked operations.
If there is a huge tree in ZooKeeper, reconnecting event will lead an
initialized TreeCache into a bad performance state, because the connection
routine was blocked by the session watcher of TreeCache.
This commit put those blocked operations into a background queue to fix this.
There is an example code snippet:
from kazoo.client import KazooClient
from kazoo.recipe.cache import TreeCache
client = KazooClient()
client.start()
cache = TreeCache(client, '/a-huge-tree')
cache.start()
# Wait the cache be initialized and trigger a connection lost event.
client.get_children('/') # The connection is still broken
The patch of this commit has been used in the production environment of
https://github.com/eleme.1 parent db0c2d4 commit 1119413
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
193 | | - | |
194 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| |||
0 commit comments