Skip to content

Commit 8f17a80

Browse files
authored
check that all tasks have been processed instead of for empty queue (#105)
1 parent d7e1354 commit 8f17a80

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
The intended audience of this file is for py42 consumers -- as such, changes that don't affect
99
how a consumer would use the library (e.g. adding unit tests, updating documentation, etc) are not captured here.
1010

11+
## 0.7.3 - 2020-06-23
12+
13+
### Fixed
14+
15+
- Fixed bug that caused the last few entries in csv files to sometimes not be processed when performing bulk processing actions.
16+
1117
## 0.7.2 - 2020-06-11
1218

1319
### Fixed

src/code42cli/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.7.2"
1+
__version__ = "0.7.3"

src/code42cli/worker.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def __init__(self, thread_count, expected_total):
5555
self._queue = queue.Queue()
5656
self._thread_count = thread_count
5757
self._stats = WorkerStats(expected_total)
58+
self._tasks = 0
5859
self.__started = False
5960
self.__start_lock = Lock()
6061

@@ -72,6 +73,7 @@ def do_async(self, func, *args, **kwargs):
7273
self.__start()
7374
self.__started = True
7475
self._queue.put({u"func": func, u"args": args, u"kwargs": kwargs})
76+
self._tasks += 1
7577

7678
@property
7779
def stats(self):
@@ -82,7 +84,7 @@ def stats(self):
8284
def wait(self):
8385
"""Wait for the tasks in the queue to complete. This should usually be called before
8486
program termination."""
85-
while not self._queue.empty():
87+
while not self._stats.total_processed >= self._tasks:
8688
sleep(0.5)
8789

8890
def _process_queue(self):

0 commit comments

Comments
 (0)