Remove the non-functional WEB pool size admin control
Setting it only rebound main.py's own module-level WEB_POOL_SIZE - runtime.py and maintenance.py each imported their own copy at process start (from config import WEB_POOL_SIZE), so the actual pool-sizing logic in ensure_web_pool()/cleanup_loop never saw the change and kept targeting the .env value. The UI control only ever changed what the admin page displayed back to itself, plus a couple of >0/<=0 branch checks in main.py - never the real pool. Removed the input, button, JS handler and the dead endpoint rather than wiring the three-module sync it would take to make it actually work. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
-12
@@ -1444,8 +1444,6 @@ def admin_page(request: Request, admin: User = Depends(require_admin), db: Sessi
|
||||
"pool_status": pool_status,
|
||||
"service_health": service_health,
|
||||
"web_totals": web_totals,
|
||||
"web_pool_size": WEB_POOL_SIZE,
|
||||
"web_pool_buffer": WEB_POOL_BUFFER,
|
||||
"recent_sessions": recent_sessions,
|
||||
"open_stats": open_stats,
|
||||
"online_sessions": online_sessions,
|
||||
@@ -3112,16 +3110,6 @@ def delete_category(category_id: int, request: Request, _: User = Depends(requir
|
||||
return {"ok": True}
|
||||
|
||||
|
||||
@app.put("/api/admin/web-pool-size")
|
||||
def update_web_pool_size(payload: dict, request: Request, _: User = Depends(require_admin)):
|
||||
validate_csrf(request)
|
||||
global WEB_POOL_SIZE
|
||||
value = max(0, int(payload.get("size", WEB_POOL_SIZE)))
|
||||
WEB_POOL_SIZE = value
|
||||
ensure_web_pool()
|
||||
return {"ok": True, "size": WEB_POOL_SIZE, "pool": get_web_pool_status()}
|
||||
|
||||
|
||||
@app.post("/api/admin/users")
|
||||
def create_user(payload: dict, request: Request, _: User = Depends(require_admin), db: Session = Depends(get_db)):
|
||||
"""The password is never typed by the admin - it's generated here and
|
||||
|
||||
@@ -287,14 +287,6 @@
|
||||
|
||||
<section id="tab-web" class="panel admin-tab" style="display:none;">
|
||||
<h3>WEB сервисы</h3>
|
||||
<div class="panel" style="padding:0.8rem;">
|
||||
<div class="list-title">Настройки общего WEB pool</div>
|
||||
<div class="actions">
|
||||
<input id="web_pool_size" type="number" min="0" value="{{ web_pool_size }}" style="max-width:220px;" />
|
||||
<button onclick="saveWebPoolSize()">Save WEB pool size</button>
|
||||
</div>
|
||||
<small>Автодоращивание: active + {{ web_pool_buffer }}</small>
|
||||
</div>
|
||||
<div class="summary-strip">
|
||||
<div class="summary-card">
|
||||
<div class="summary-label">WEB сервисов</div>
|
||||
@@ -1007,12 +999,6 @@
|
||||
document.getElementById('w_name').focus();
|
||||
}
|
||||
|
||||
async function saveWebPoolSize() {
|
||||
const size = parseInt(document.getElementById('web_pool_size').value || '0', 10);
|
||||
await api('/api/admin/web-pool-size', 'PUT', {size});
|
||||
location.reload();
|
||||
}
|
||||
|
||||
async function saveWebService() {
|
||||
const id = document.getElementById('w_id').value;
|
||||
const slug = document.getElementById('w_slug').value || slugifyRu(document.getElementById('w_name').value);
|
||||
|
||||
Reference in New Issue
Block a user