Skip to content

Commit

Permalink
fixup! Fix: Diagnostic could be improved
Browse files Browse the repository at this point in the history
  • Loading branch information
hoh committed Jan 12, 2024
1 parent 14ea68a commit 7d1a0b5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/aleph/vm/orchestrator/views/host_status.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import logging
import socket
from typing import Tuple, Callable
from typing import Any, Awaitable, Callable, Tuple

import aiohttp

from aleph.vm.conf import settings


logger = logging.getLogger(__name__)


def return_false_on_timeout(func):
async def wrapper(*args, **kwargs):
def return_false_on_timeout(func: Callable[..., Awaitable[Any]]) -> Callable[..., Awaitable[bool]]:
async def wrapper(*args: Any, **kwargs: Any) -> bool:
try:
return await func(*args, **kwargs)
except TimeoutError:
logger.warning(f"Timeout while checking {func.__name__}")
return False

return wrapper


Expand Down

0 comments on commit 7d1a0b5

Please sign in to comment.