fix: handle socket close errors properly in PapertrailLogHandler
- Replace contextlib.suppress with try/except + warning log - Add test for fail2ban client - Remove stale Issue #21 from Tasks.md (indexes) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -7,7 +7,6 @@ fashion using async buffering and batching.
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import contextlib
|
||||
import json
|
||||
from abc import ABC, abstractmethod
|
||||
from collections import deque
|
||||
@@ -244,8 +243,10 @@ class PapertrailLogHandler(ExternalLogHandler):
|
||||
await writer.drain()
|
||||
finally:
|
||||
writer.close()
|
||||
with contextlib.suppress(Exception):
|
||||
try:
|
||||
await writer.wait_closed()
|
||||
except Exception as e:
|
||||
log.warning("external_logging_writer_close_error", error=str(e))
|
||||
|
||||
@staticmethod
|
||||
def _severity_from_level(level: str) -> int:
|
||||
|
||||
Reference in New Issue
Block a user