Skip to content

Commit

Permalink
Log number of "file" service uploads
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Easterbrook <jim@jim-easterbrook.me.uk>
  • Loading branch information
jim-easterbrook committed Aug 29, 2018
1 parent 9668be3 commit 8d0bfd2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pywws/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '18.8.0'
_release = '1606'
_commit = '90907f6'
_release = '1607'
_commit = '9668be3'
6 changes: 6 additions & 0 deletions src/pywws/service/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ def upload_batch(self):
pending = eval(
self.context.status.get('pending', self.service_name, '[]'))
OK = True
count = 0
with self.session() as session:
while self.queue and not self.context.shutdown.is_set():
upload = self.queue[0]
Expand All @@ -418,12 +419,17 @@ def upload_batch(self):
if OK:
if upload in pending:
pending.remove(upload)
count += 1
else:
if upload not in pending:
pending.append(upload)
break
self.queue.popleft()
self.context.status.set('pending', self.service_name, repr(pending))
if count > 1:
self.logger.warning('{:d} uploads'.format(count))
elif count:
self.logger.info('1 upload')
return OK


Expand Down

0 comments on commit 8d0bfd2

Please sign in to comment.