summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2014-08-31 01:32:38 -0700
committerJoshua Harlow <harlowja@gmail.com>2014-08-31 01:32:38 -0700
commit3f9c32828c37279e7df56ea60b32d0eca68f169a (patch)
treeea640f58520d8700b4d955a6af76d890b1302079
parent2c35f54110fe610a3a051b1850e69b85af2c3e23 (diff)
downloadzake-3f9c32828c37279e7df56ea60b32d0eca68f169a.tar.gz
Put the path deletions into there own mini-transaction
-rw-r--r--zake/fake_client.py37
1 files changed, 19 insertions, 18 deletions
diff --git a/zake/fake_client.py b/zake/fake_client.py
index c469792..e2c313b 100644
--- a/zake/fake_client.py
+++ b/zake/fake_client.py
@@ -430,24 +430,25 @@ class _PartialClient(object):
% (path, len(children)))
paths = [path]
paths = list(reversed(sorted(set(paths))))
- for p in paths:
- self.storage.pop(p)
- parents = []
- for p in paths:
- parents.extend(self.storage.get_parents(p))
- parents = list(reversed(sorted(set(parents))))
- for p in parents:
- event = k_states.WatchedEvent(
- type=k_states.EventType.DELETED,
- state=k_states.KeeperState.CONNECTED,
- path=p)
- child_watches.append(([p], event))
- for p in paths:
- event = k_states.WatchedEvent(
- type=k_states.EventType.DELETED,
- state=k_states.KeeperState.CONNECTED,
- path=p)
- data_watches.append(([p], event))
+ with self.storage.transaction():
+ for p in paths:
+ self.storage.pop(p)
+ parents = []
+ for p in paths:
+ parents.extend(self.storage.get_parents(p))
+ parents = list(reversed(sorted(set(parents))))
+ for p in parents:
+ event = k_states.WatchedEvent(
+ type=k_states.EventType.DELETED,
+ state=k_states.KeeperState.CONNECTED,
+ path=p)
+ child_watches.append(([p], event))
+ for p in paths:
+ event = k_states.WatchedEvent(
+ type=k_states.EventType.DELETED,
+ state=k_states.KeeperState.CONNECTED,
+ path=p)
+ data_watches.append(([p], event))
return (True, data_watches, child_watches)
def set(self, path, value, version=-1):