MCPcopy Create free account
hub / github.com/celery/celery / loop

Method loop

celery/worker/pidbox.py:109–126  ·  view source on GitHub ↗
(self, c)

Source from the content-addressed store, hash-verified

107 self.consumer.consume()
108
109 def loop(self, c):
110 resets = [self._resets]
111 shutdown = self._node_shutdown = threading.Event()
112 stopped = self._node_stopped = threading.Event()
113 try:
114 with c.connection_for_read() as connection:
115 info('pidbox: Connected to %s.', connection.as_uri())
116 self._do_reset(c, connection)
117 while not shutdown.is_set() and c.connection:
118 if resets[0] < self._resets:
119 resets[0] += 1
120 self._do_reset(c, connection)
121 try:
122 connection.drain_events(timeout=1.0)
123 except socket.timeout:
124 pass
125 finally:
126 stopped.set()

Callers 7

test_loopMethod · 0.80
_get_on_messageMethod · 0.80
test_loopMethod · 0.80
startMethod · 0.80

Calls 8

_do_resetMethod · 0.95
infoFunction · 0.85
EventMethod · 0.80
is_setMethod · 0.80
connection_for_readMethod · 0.45
as_uriMethod · 0.45
drain_eventsMethod · 0.45
setMethod · 0.45

Tested by 6

test_loopMethod · 0.64
_get_on_messageMethod · 0.64
test_loopMethod · 0.64