auto: black run

This commit is contained in:
2021-01-07 22:32:36 +03:00
parent af06978cc9
commit 885e17754b
9 changed files with 43 additions and 49 deletions

View File

@@ -46,11 +46,7 @@ def _process_main(results_queue: queue.Queue, task: AnalyzeTask):
res["status"] = "success"
except Exception as err:
logging.exception(f"Error {err} with {task.url}")
res = {
"status": "error",
"message": str(err),
"task_id": task.task_id
}
res = {"status": "error", "message": str(err), "task_id": task.task_id}
results_queue.put(res)
@@ -58,10 +54,7 @@ def rabbit_callback(ch, method, properties, body):
task = AnalyzeTask.from_data(json.loads(body))
logging.info(f"New task url: {task.url}, level: {task.level}")
res_queue = multiprocessing.Queue()
method_process = multiprocessing.Process(
target=_process_main,
args=(res_queue, task)
)
method_process = multiprocessing.Process(target=_process_main, args=(res_queue, task))
method_process.start()
for delay in delay_generator():
ch.connection.sleep(delay)