metasync: send actions by batch of size 100

This commit is contained in:
Benjamin Dauvergne 2015-05-19 22:13:36 +02:00
parent a4c68afbaa
commit 801d0d7c75
1 changed files with 12 additions and 14 deletions

View File

@ -361,18 +361,16 @@ def apply_action(action):
actions.sort(key=lambda x: (x[0] == DELETE, len(x[1])))
if args.verbose:
print 'Actions:'
for action in actions:
for batch in batch_generator(actions, 100):
for action in batch:
if args.verbose:
print_action(action)
if not args.fake:
apply_action(action)
else:
print 'Fake, doing nothing'
if args.verbose:
print_action(action)
if not args.fake:
apply_action(action)
else:
print 'Fake, doing nothing'
if args.verbose:
print 'Waiting for completion..',
i = len(actions)
while i:
lconn.result()
i -= 1
print ' done'
print 'Waiting for completion..',
for action in batch:
lconn.result()
print ' done'