MCPcopy
hub / github.com/benoitc/gunicorn / run_for_one

Method run_for_one

gunicorn/workers/sync.py:58–85  ·  view source on GitHub ↗
(self, timeout)

Source from the content-addressed store, hash-verified

56 return True
57
58 def run_for_one(self, timeout):
59 listener = self.sockets[0]
60 while self.alive:
61 self.notify()
62
63 # Accept a connection. If we get an error telling us
64 # that no connection is waiting we fall down to the
65 # select which is where we'll wait for a bit for new
66 # workers to come give us some love.
67 try:
68 self.accept(listener)
69 # Keep processing clients until no one is waiting. This
70 # prevents the need to select() for every client that we
71 # process.
72 continue
73
74 except OSError as e:
75 if e.errno not in (errno.EAGAIN, errno.ECONNABORTED,
76 errno.EWOULDBLOCK):
77 raise
78
79 if not self.is_parent_alive():
80 return
81
82 try:
83 self.wait(timeout)
84 except StopWaiting:
85 return
86
87 def run_for_multiple(self, timeout):
88 while self.alive:

Callers 1

runMethod · 0.95

Calls 4

acceptMethod · 0.95
is_parent_aliveMethod · 0.95
waitMethod · 0.95
notifyMethod · 0.45

Tested by

no test coverage detected