MCPcopy Create free account
hub / github.com/coleifer/huey / wait_result

Method wait_result

huey/storage.py:185–203  ·  view source on GitHub ↗

Block until a result is available for the given key, or until the timeout expires. Returns True if the result is available, or False if the timeout expired. The default implementation polls with exponential backoff, but Redis subclasses provide option to ove

(self, key, timeout=None, backoff=1.15, max_delay=1.0)

Source from the content-addressed store, hash-verified

183 raise NotImplementedError
184
185 def wait_result(self, key, timeout=None, backoff=1.15, max_delay=1.0):
186 """
187 Block until a result is available for the given key, or until the
188 timeout expires. Returns True if the result is available, or False if
189 the timeout expired.
190
191 The default implementation polls with exponential backoff, but Redis
192 subclasses provide option to override with BLPOP for lower latency
193 result notification (specify notify_result=True).
194 """
195 deadline = None if timeout is None else time.monotonic() + timeout
196 delay = 0.05
197 while True:
198 if self.has_data_for_key(key):
199 return True
200 if deadline is not None and time.monotonic() >= deadline:
201 return False
202 time.sleep(min(delay, max_delay))
203 delay *= backoff
204
205 def delete_data(self, key):
206 """

Callers 4

wait_resultMethod · 0.45
get_raw_resultMethod · 0.45
test_wait_resultMethod · 0.45

Calls 2

has_data_for_keyMethod · 0.95
sleepMethod · 0.45

Tested by 2

test_wait_resultMethod · 0.36