Skip to content

loop_health_addon

messageflux.service_addons.loop_health_addon

LoopHealthAddon

LoopHealthAddon(
    *,
    max_consecutive_failures=None,
    max_inactivity_timeout=None
)

an addon that can be attached to a service, to make sure he is healthy. if the service gets stuck (service loop inactivity) or has to many consecutive failures, the addons stops the service

Parameters:

Name Type Description Default
max_consecutive_failures Optional[int]

the number of consecutive service loop failures, after which the service is stopped. None means to allow any number of failures

None
max_inactivity_timeout Optional[float]

the number of seconds of inactivity (no loop ended events...) after which the service is stopped. None means to ignore inactivity.

None

consecutive_failures property

consecutive_failures

the number of consecutive failures the service has had

last_loop_time property

last_loop_time

the last time that the service loop has ended

service property

service

the attached service (or None if no service is attached)

attach

attach(service)

attached the addon to a service, and returns the addon

Parameters:

Name Type Description Default
service ServerLoopService

the service to attach to

required

detach

detach()

detaches from a service

LoopHealthAddonException

LoopHealthAddonException(*args, **kwargs)

Bases: KwargsException

an exception that is raised on LoopHealthAddon errors