Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
Move timeout to select call
Browse files Browse the repository at this point in the history
  • Loading branch information
cjh1 committed Apr 18, 2017
1 parent c1aae0a commit e299660
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions girder_worker/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import sys
import tempfile
import traceback
import time


class TerminalColor(object):
Expand Down Expand Up @@ -292,8 +291,8 @@ def select_loop(exit_condition=lambda: True, close_output=lambda x: True,

try:
while True:
# get ready pipes
readable, writable, _ = select.select(rds, wds, (), 0)
# get ready pipes, timeout of 100 ms
readable, writable, _ = select.select(rds, wds, (), 0.1)

# We evaluate this first so that we get one last iteration of
# of the loop before breaking out of the loop.
Expand Down Expand Up @@ -323,10 +322,6 @@ def select_loop(exit_condition=lambda: True, close_output=lambda x: True,
wds.remove(ready_fd)
os.close(ready_fd)

# If we didn't do anything sleep for 100 ms to avoid hot loop
if not readable and not writable:
time.sleep(0.1)

wds, fifos, inputs = _open_ipipes(wds, fifos, inputs)
# all pipes empty?
empty = (not rds or not readable) and (not wds or not writable)
Expand Down

0 comments on commit e299660

Please sign in to comment.