koi_net.components.event_worker
Classes
|
Class for |
|
Thread worker that processes the |
- class koi_net.components.event_worker.End[source]
Bases:
objectClass for
STOP_WORKERsentinel pushed to worker queues.
- class koi_net.components.event_worker.EventProcessingWorker(log, logging_context, shutdown_signal, exception_queue, config, cache, event_queue, request_handler, poll_event_buf, broadcast_event_buf)[source]
Bases:
ThreadedComponentThread worker that processes the
event_queue.- Parameters:
log (Logger)
logging_context (LoggingContext)
shutdown_signal (Event)
exception_queue (Queue[Exception])
config (BaseNodeConfig)
cache (Cache)
event_queue (EventQueue)
request_handler (RequestHandler)
poll_event_buf (EventBuffer)
broadcast_event_buf (EventBuffer)
- broadcast_event_buf: EventBuffer
- cache: Cache
- config: BaseNodeConfig
- event_queue: EventQueue
- flush_and_broadcast(target, force_flush=False)[source]
Broadcasts all events to target in event buffer.
- Parameters:
target (KoiNetNode)
force_flush (bool)
- poll_event_buf: EventBuffer
- request_handler: RequestHandler
- run()[source]
Main loop of event worker thread.
Dequeues events from
event_queueand pushes them topoll_event_buforbroadcast_event_bufdepending on the node type. Special handling for communication with first contact node, which is assumed to be a full node if its profile cannot be found.Automatically flushes
broadcast_event_bufwhen it reaches max length, or max wait time.Gracefully shuts down upon dequeueing
STOP_WORKERsentinel.