mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-29 04:50:21 +00:00
Back off progress update on file copy
The output was too frenzied, cool it down to fewer updates.
This commit is contained in:
parent
b27d07f304
commit
865d18d367
@ -529,12 +529,15 @@ def import_image(filename, callback, backend=False, mfd=None):
|
||||
currsz = 0
|
||||
modpct = 1.0 - pct
|
||||
archive.seek(0, 0)
|
||||
printat = 0
|
||||
with open(targiso, 'wb') as targ:
|
||||
buf = archive.read(32768)
|
||||
while buf:
|
||||
currsz += len(buf)
|
||||
pgress = pct + ((float(currsz) / float(totalsz)) * modpct)
|
||||
callback({'progress': pgress})
|
||||
if time.time() > printat:
|
||||
callback({'progress': pgress})
|
||||
printat = time.time() + 0.5
|
||||
targ.write(buf)
|
||||
buf = archive.read(32768)
|
||||
with open(targpath + '/distinfo.yaml', 'w') as distinfo:
|
||||
|
Loading…
Reference in New Issue
Block a user