Redis push в фоновом потоке (не блокирует ответ), v1.41

This commit is contained in:
2026-06-17 22:43:56 +04:00
parent 9bae90e9a0
commit f9cb9de91d
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -180,8 +180,10 @@ class ContractsApp:
finally:
db.put_conn(conn)
# Файл — в Redis (мгновенно)
redis_client.push({"filename": filename, "b64": b64, "mime": mime, "cid": str(cid)})
# Файл — в Redis (в фоне, не блокируем ответ)
import threading
task = {"filename": filename, "b64": b64, "mime": mime, "cid": str(cid)}
threading.Thread(target=redis_client.push, args=(task,), daemon=True).start()
return jsonify({"contract_id": str(cid)})
except Exception as e: