kilter.service.util module
Common helper utilities
- class Broadcast[source]
-
A reliable, blocking message queue for delivering to multiple listening tasks
Listeners must acquire the lock (by using the
Broadcast
instance as a context manager) before callingBroadcast.receive()
or it will fail. If a listener is repeatedly awaiting messages in a loop, the loop should be inside the locked context or messages may be lost to race conditions.- async pre_receive_hook() None [source]
A hook for subclasses to inject synchronisation instructions before awaiting objects
- async post_send_hook() None [source]
A hook for subclasses to inject synchronisation instructions after sending objects
- async shutdown_hook() None [source]
A hook for subclasses to inject cleanup or synchronisation instructions on close
Users must ensure this method is called, especially if using a subclass which implements it.
- async abort(exc: BaseException | type[BaseException]) None [source]
Send a notification to all listeners to abort by raising an exception