keepalive/keepalive.py
async def check_service(
    config: Config, service: Service, state: State, session: aiohttp.ClientSession
) -> None:
    """
    Check a service and send notifications.
    """
    logger.debug(f"Checking service {service['name']}...")

    try:
        healthy, output = await get_service_health(service, session)
        prev_healthy = state[service["name"]]

        if not healthy:
            logger.info(f"Service {service['name']} is not healthy!")
            await on_service_error(config, service, session, output or "Unknown Error")

        elif healthy and not prev_healthy:
            logger.info(f"Service {service['name']} is healthy once again.")
            await on_service_healthy(config, service, session)

        state[service["name"]] = healthy

    except Exception as err:
        logger.exception(err)

    logger.debug(f"Service {service['name']} checked.")

    Check a service and send notifications.
    
Check a service and send notifications.
Check a service and send notifications .
async def check_service(
    config: Config, service: Service, state: State, session: aiohttp.ClientSession
) -> None:
    logger.debug(f"Checking service {service['name']}...")
    try:
        healthy, output = await get_service_health(service, session)
        prev_healthy = state[service["name"]]
        if not healthy:
            logger.info(f"Service {service['name']} is not healthy!")
            await on_service_error(config, service, session, output or "Unknown Error")
        elif healthy and not prev_healthy:
            logger.info(f"Service {service['name']} is healthy once again.")
            await on_service_healthy(config, service, session)
        state[service["name"]] = healthy
    except Exception as err:
        logger.exception(err)
    logger.debug(f"Service {service['name']} checked.")
async def check_service ( config : Config , service : Service , state : State , session : aiohttp . ClientSession ) -> None : logger . debug ( f"Checking service {service['name']}..." ) try : healthy , output = await get_service_health ( service , session ) prev_healthy = state [ service [ "name" ] ] if not healthy : logger . info ( f"Service {service['name']} is not healthy!" ) await on_service_error ( config , service , session , output or "Unknown Error" ) elif healthy and not prev_healthy : logger . info ( f"Service {service['name']} is healthy once again." ) await on_service_healthy ( config , service , session ) state [ service [ "name" ] ] = healthy except Exception as err : logger . exception ( err ) logger . debug ( f"Service {service['name']} checked." )
Check a service and send notifications.
Check a service and send notifications .
"""
    Check a service and send notifications.
    """
config
Config
service
Service
state
State
session
aiohttp.ClientSession