Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lower select timeout #263

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions supervisor/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,17 +345,15 @@ class deferring_http_channel(http_server.http_channel):
# order to spew tail -f output faster (speculative)
ac_out_buffer_size = 4096

delay = False
writable_check = time.time()
def __init__(self, *args, **kwargs):
self.delay_until = False
http_server.http_channel.__init__(self, *args, **kwargs)

def writable(self, t=time.time):
now = t()
if self.delay:
def writable(self):
if self.delay_until:
# we called a deferred producer via this channel (see refill_buffer)
last_writable_check = self.writable_check
self.writable_check = now
elapsed = now - last_writable_check
if elapsed > self.delay:
if time.time() > self.delay_until:
self.delay_until = False
return True
else:
return False
Expand All @@ -382,12 +380,12 @@ def refill_buffer (self):
data = p.more()

if data is NOT_DONE_YET:
self.delay = p.delay
self.delay_until = time.time() + p.delay
return

elif data:
self.ac_out_buffer = self.ac_out_buffer + data
self.delay = False
self.delay_until = False
return
else:
self.producer_fifo.pop()
Expand Down
2 changes: 1 addition & 1 deletion supervisor/supervisord.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def ordered_stop_groups_phase_2(self):

def runforever(self):
events.notify(events.SupervisorRunningEvent())
timeout = 1 # this cannot be fewer than the smallest TickEvent (5)
timeout = 0.1

socket_map = self.options.get_socket_map()

Expand Down