fix(nodes): детерминированная сортировка списка серверов
All checks were successful
Backend Tests / pytest (Python 3.12) (push) Successful in 1m0s
Deploy to Production / Trigger production update (push) Successful in 7s

Список серверов терял порядок при фоновом рефетче (каждые 30с),
т.к. запрос с WHERE id IN (...) не гарантирует стабильный порядок строк.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
markmorado
2026-07-10 00:40:17 +05:00
parent 3424823793
commit e62626c79b

View File

@@ -69,7 +69,7 @@ def list_proxmox_servers(
if is_privileged:
# Privileged: use workspace filter only
server_ids = get_workspace_server_ids(request, db, current_user)
query = db.query(ProxmoxServer)
query = db.query(ProxmoxServer).order_by(ProxmoxServer.id)
if server_ids is not None:
query = query.filter(ProxmoxServer.id.in_(server_ids))
servers = query.all()
@@ -105,7 +105,7 @@ def list_proxmox_servers(
if not effective_ids:
return []
servers = db.query(ProxmoxServer).filter(ProxmoxServer.id.in_(effective_ids)).all()
servers = db.query(ProxmoxServer).filter(ProxmoxServer.id.in_(effective_ids)).order_by(ProxmoxServer.id).all()
_attach_workspaces(db, servers)
return servers