Skip to content

Commit e85a168

Browse files
committed
Do not change timeout variable on every iteration
1 parent 2d1078a commit e85a168

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

supervisor/supervisord.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,12 @@ def ordered_stop_groups_phase_2(self):
173173

174174
def runforever(self):
175175
events.notify(events.SupervisorRunningEvent())
176+
timeout = 1 # this cannot be fewer than the smallest TickEvent (5)
176177
first_poll = True
177178

178179
socket_map = self.options.get_socket_map()
179180

180181
while 1:
181-
if first_poll:
182-
timeout = 0
183-
first_poll = False
184-
else:
185-
timeout = 1 # this cannot not be fewer than the smallest TickEvent (5)
186-
187182
combined_map = {}
188183
combined_map.update(socket_map)
189184
combined_map.update(self.get_process_map())
@@ -212,7 +207,12 @@ def runforever(self):
212207
if dispatcher.writable():
213208
self.options.poller.register_writable(fd)
214209

215-
r, w = self.options.poller.poll(timeout)
210+
if first_poll:
211+
# initial timeout of 0 avoids delaying supervisord startup
212+
r, w = self.options.poller.poll(0)
213+
first_poll = False
214+
else:
215+
r, w = self.options.poller.poll(timeout)
216216

217217
for fd in r:
218218
if fd in combined_map:

0 commit comments

Comments
 (0)