Standardize async offloading behind shared executor helper

This commit is contained in:
2026-04-11 20:40:08 +02:00
parent ae81a8f5be
commit cd69550053
13 changed files with 199 additions and 101 deletions

View File

@@ -13,6 +13,7 @@ routers can serialise them directly.
from __future__ import annotations
import asyncio
from app.utils.async_utils import run_blocking
import contextlib
import re
from pathlib import Path
@@ -750,8 +751,8 @@ async def read_fail2ban_log(
loop = asyncio.get_event_loop()
total_lines, raw_lines = await asyncio.gather(
loop.run_in_executor(None, _count_file_lines, resolved_str),
loop.run_in_executor(None, _read_tail_lines, resolved_str, lines),
run_blocking( _count_file_lines, resolved_str),
run_blocking( _read_tail_lines, resolved_str, lines),
)
filtered = (