modified: backend/app.py

modified:   frontend/index.html
	modified:   frontend/js/app.js
This commit is contained in:
2026-05-15 19:02:24 +03:00
parent 2df4f52adb
commit 641f9e1d8c
3 changed files with 31 additions and 1 deletions

View File

@@ -59,9 +59,36 @@ app.register_blueprint(finance_blueprint, url_prefix='/api')
app.register_blueprint(team_blueprint, url_prefix='/api')
app.register_blueprint(repricer_blueprint, url_prefix='/api')
# Health check endpoint - проверка состояния приложения и БД
from flask import jsonify
from .db import get_db_connection, release_db_connection
@app.route('/api/health')
def health_check():
db_status = "ok"
db_error = None
try:
conn = get_db_connection()
cur = conn.cursor()
cur.execute("SELECT 1")
release_db_connection(conn)
except Exception as e:
db_status = "error"
db_error = str(e)
status = "ok" if db_status == "ok" else "degraded"
return jsonify({
"status": status,
"backend": "ok",
"database": db_status,
"db_error": db_error
}), 200 if status == "ok" else 503
import threading
import time
def background_scanner():
"""Фоновая задача для имитации сканирования маркетплейсов."""
while True: