[Kimchi-devel] [PATCHv4 6/7] Storage volume upload: Adding progress to task message
Crístian Viana
vianac at linux.vnet.ibm.com
Thu Sep 4 15:18:37 UTC 2014
On 04-09-2014 06:25, lvroyce at linux.vnet.ibm.com wrote:
> try:
> + size = 0
> f = open(file_path, 'wb')
> + pool.refresh()
> while True:
> data = upload_file.file.read(8192)
> if not data:
> break
> + size += len(data)
> f.write(data)
> + cb('%s/%s' % (f_len, size), True)
> f.close()
Is there any specific reason the method "pool.refresh()" is called from
inside the loop? I mean, is it necessary for the upload operation /
partial data retrieval? If not, I'd suggest to keep that command outside
the loop (as it is now). That loop will run for many iterations (e.g. ~
90,000 for a 700 MB ISO file), so the less we execute inside that loop,
the better.
More information about the Kimchi-devel
mailing list