linotp.lib.remote_service module¶
Bases:
ExceptionThrown when all services are unavailable.
This exception will be passed on to callers of RemoteService.call_first_available when there are no functional services left.
- class linotp.lib.remote_service.RemoteService(func, failure_threshold=5, recovery_timeout=30, expected_exception=<class 'Exception'>)¶
Bases:
objectA service that keeps track of it failures and marks itself as unavilable after an exceeding amount of configured (base) exceptions.
- on_failure()¶
- on_recovery()¶
- class linotp.lib.remote_service.RemoteServiceList(failure_threshold=5, recovery_timeout=30, expected_exception=<class 'Exception'>)¶
Bases:
listA list of services that will transparently failover to the next service if one failes.
- append(func, **kwargs)¶
Append object to the end of the list.
- call_first_available(*args, **kwargs)¶
calls the first available service with the supplied arguments.
- Raises
AllServicesUnavailable – If no service is available at the moment
Bases:
ExceptionThrown when a service is unavailable.
This exception is used for failover to other services and not passed to users.
- class linotp.lib.remote_service.State¶
Bases:
objectState of a Service
- FUNCTIONAL = 1¶
- UNAVAILABLE = 2¶
- linotp.lib.remote_service.now()¶
Return the current time.
This function is required for datetime mocking during testing.