log: Improve processing logs
This commit is contained in:
@@ -89,17 +89,15 @@ def process_task_replies(session, channel, consume_count: int):
|
||||
):
|
||||
if data is None:
|
||||
return
|
||||
data = data.decode("utf-8")
|
||||
raw_reply = json.loads(data)
|
||||
raw_reply = json.loads(data.decode("utf-8"))
|
||||
task_id = raw_reply["task_id"]
|
||||
logging.info(f"New response: {raw_reply}")
|
||||
db_task = session.query(AnalyzeTask).filter(AnalyzeTask.id == task_id).first()
|
||||
if db_task is None:
|
||||
logging.warning(f"task_id {task_id} not found in DB")
|
||||
continue
|
||||
if raw_reply["status"] == "error":
|
||||
db_task.status = TaskStatus.Error
|
||||
logging.error(f"Error {raw_reply['message']} with task_id {task_id} not found in DB")
|
||||
logging.error(f"Error `{raw_reply['message']}` with task_id {task_id}.")
|
||||
continue
|
||||
response = AnalyzeResponse.from_data(raw_reply)
|
||||
db_task.status = TaskStatus.Success
|
||||
|
||||
Reference in New Issue
Block a user