Skip to content

Commit

Permalink
Make total_size some small number (#46)
Browse files Browse the repository at this point in the history
This initializes total_size of the bundle to some small number. This
value is used as an estimate for the total size and the divisor in
calculations so to prevent divide by zero errors.

Signed-off-by: David Brown <dmlb2000@gmail.com>
  • Loading branch information
dmlb2000 committed Jan 25, 2019
1 parent 26a1ab2 commit ec9043d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions appveyor.yml
Expand Up @@ -70,6 +70,7 @@ install:
python -m pip install pip setuptools wheel --upgrade;
pip install -r requirements-dev.txt;
pip install celery[redis] eventlet;
echo 'Done';
test_script:
Expand Down
6 changes: 4 additions & 2 deletions pacifica/uploader/bundler/bundler.py
Expand Up @@ -82,11 +82,13 @@ def __init__(self, md_obj, file_data, **kwargs):
self._hashstr = hashstr
self._done_size = 0
self._complete = False
self._total_size = 0
# this is an estimate of the total size and is used as a divisor
# to determine percent complete, so small number is okay
self._total_size = 0.0001

def _save_total_size(self):
"""Build the total size from the files and save the total."""
tsize = 0
tsize = 0.0001
for file_data in self.file_data:
tsize += file_data['size']
self._total_size = tsize
Expand Down

0 comments on commit ec9043d

Please sign in to comment.