less net i/o

This commit is contained in:
j 2011-04-06 16:53:45 +02:00
parent a989842b3a
commit df874cd202

View file

@ -251,14 +251,19 @@ class Client(object):
if r['data']['info']:
info = r['data']['info']
max_info = 100
for offset in range(0, len(info), max_info):
post = {'info': {}}
total = len(info)
for offset in range(0, total, max_info):
post = {'info': {}, 'upload': True}
for oshash in info[offset:offset+max_info]:
if oshash in files['info']:
post['info'][oshash] = files['info'][oshash]
print 'sending info for new files', len(post['info'])
print 'sending info for new files', len(post['info']), offset, total
r = self.api.update(post)
#send empty list to get updated list of requested info/files/data
post = {'info': {}}
r = self.api.update(post)
filenames = {}
for f in files['files']:
filenames[f['oshash']] = f['path']