MCPcopy
hub / github.com/Koed00/django-q / result_cached

Function result_cached

django_q/tasks.py:154–167  ·  view source on GitHub ↗

Return the result from the cache backend

(task_id, wait=0, broker=None)

Source from the content-addressed store, hash-verified

152
153
154def result_cached(task_id, wait=0, broker=None):
155 """
156 Return the result from the cache backend
157 """
158 if not broker:
159 broker = get_broker()
160 start = time()
161 while True:
162 r = broker.cache.get(f"{broker.list_key}:{task_id}")
163 if r:
164 return SignedPackage.loads(r)["result"]
165 if (time() - start) * 1000 >= wait >= 0:
166 break
167 sleep(0.01)
168
169
170def result_group(group_id, failures=False, wait=0, count=None, cached=Conf.CACHED):

Callers 1

resultFunction · 0.85

Calls 3

get_brokerFunction · 0.90
getMethod · 0.45
loadsMethod · 0.45

Tested by

no test coverage detected