Skip to content

Commit 1a1bd49

Browse files
authored
Merge pull request #9163 from mvdbeek/print_progress_improvements
[20.01] mulled: use threading.Event in PrintProgress to avoid unnecessary wai…
2 parents e4f069c + 4a89e82 commit 1a1bd49

File tree

1 file changed

+4
-5
lines changed
  • lib/galaxy/tool_util/deps/mulled

1 file changed

+4
-5
lines changed

lib/galaxy/tool_util/deps/mulled/util.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import sys
99
import tarfile
1010
import threading
11-
import time
1211
from io import BytesIO
1312

1413
import packaging.version
@@ -293,21 +292,21 @@ def split_container_name(name):
293292
class PrintProgress(object):
294293
def __init__(self):
295294
self.thread = threading.Thread(target=self.progress)
296-
self.stop = False
295+
self.stop = threading.Event()
297296

298297
def progress(self):
299-
while not self.stop:
298+
while not self.stop.is_set():
300299
print(".", end="")
301300
sys.stdout.flush()
302-
time.sleep(60)
301+
self.stop.wait(60)
303302
print("")
304303

305304
def __enter__(self):
306305
self.thread.start()
307306
return self
308307

309308
def __exit__(self, exc_type, exc_val, exc_tb):
310-
self.stop = True
309+
self.stop.set()
311310
self.thread.join()
312311

313312

0 commit comments

Comments
 (0)