mirror of https://github.com/skygpu/skynet.git
Rework if statement to reduce indentation, add comment about logic
parent
4d56bb45e5
commit
b62cdd6802
|
@ -177,11 +177,13 @@ class WorkerDaemon:
|
|||
return False
|
||||
|
||||
results = [res['id'] for res in self._snap['results']]
|
||||
if (
|
||||
rid not in results
|
||||
and
|
||||
rid in self._snap['requests']
|
||||
):
|
||||
|
||||
# if worker is already on that request or
|
||||
# if worker has a stale status for that request
|
||||
if rid in results or rid not in self._snap['requests']:
|
||||
logging.info(f'request {rid} already beign worked on, skip...')
|
||||
return
|
||||
|
||||
statuses = self._snap['requests'][rid]
|
||||
if len(statuses) == 0:
|
||||
inputs = []
|
||||
|
@ -261,11 +263,6 @@ class WorkerDaemon:
|
|||
finally:
|
||||
return True
|
||||
|
||||
# TODO, i would inverse this case logic to avoid an indent
|
||||
# level in above block ;)
|
||||
else:
|
||||
logging.info(f'request {rid} already beign worked on, skip...')
|
||||
|
||||
# TODO, as per above on `.maybe_serve_one()`, it's likely a bit
|
||||
# more *trionic* to define this all as a module level task-func
|
||||
# which operates on a `daemon: WorkerDaemon`?
|
||||
|
|
Loading…
Reference in New Issue