v0.1.1
All checks were successful
Build and Deploy Docker Image / build-and-push (push) Successful in 3m56s
All checks were successful
Build and Deploy Docker Image / build-and-push (push) Successful in 3m56s
-- added automativ queue reconenction (querying for queues to join from server)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
from datetime import datetime, timedelta
|
||||
@@ -40,6 +41,7 @@ from fasthtml.common import (
|
||||
from fasthtml.pico import Card, Container, picolink
|
||||
from fasthtml.xtend import Style
|
||||
from keycloak.pkce_utils import generate_code_challenge, generate_code_verifier
|
||||
from modules.rabbitmq import consume_messages_topic
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -363,7 +365,7 @@ async def dashboard():
|
||||
Div(
|
||||
id="client-status",
|
||||
hx_get="/client-status",
|
||||
hx_trigger="load, every 30s",
|
||||
hx_trigger="load, every 15s",
|
||||
),
|
||||
),
|
||||
Div(id="memory-stats", hx_get="/memory-stats", hx_trigger="load, every 5s"),
|
||||
@@ -382,10 +384,10 @@ async def dashboard():
|
||||
@app.route("/client-status", methods="get")
|
||||
async def status():
|
||||
"""Получить статус клиента из центрального микросервиса"""
|
||||
token_data = load_token()
|
||||
access_token = get_valid_access_token()
|
||||
client_info = load_client_info()
|
||||
|
||||
if not token_data or not client_info:
|
||||
if not access_token or not client_info:
|
||||
return P("Клиент не зарегистрирован", style="color: orange;")
|
||||
|
||||
if rabbitmq_manager._connection:
|
||||
@@ -395,6 +397,8 @@ async def status():
|
||||
) # get_client_status(client_name, access_token)
|
||||
|
||||
if status:
|
||||
await consume_messages_topic()
|
||||
|
||||
return Div(
|
||||
P(
|
||||
Strong("Статус клиента: "),
|
||||
@@ -413,6 +417,17 @@ async def status():
|
||||
),
|
||||
style="padding: 10px; border-radius: 5px; margin: 10px 0;",
|
||||
)
|
||||
else:
|
||||
return Div(
|
||||
P(
|
||||
Strong("Статус клиента: "),
|
||||
Span("Не подключен", style="color: orange;"),
|
||||
),
|
||||
P(
|
||||
"Не удалось связаться с центральным сервисом или данному клиенту отказано в подключении"
|
||||
),
|
||||
style="padding: 10px; border-radius: 5px; margin: 10px 0;",
|
||||
)
|
||||
|
||||
|
||||
@app.route("/memory-stats", methods="get")
|
||||
|
||||
Reference in New Issue
Block a user