Standardize async offloading behind shared executor helper
This commit is contained in:
@@ -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 = (
|
||||
|
||||
Reference in New Issue
Block a user