MCPcopy
hub / github.com/celery/celery / loop

Method loop

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

Source from the content-addressed store, hash-verified

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