cluster/websocket: Make websocket dispatcher queue size configurable

Limit the number WebSocket events queued from external clients to
dispatcher instances to produce back pressure to the clients if
Zeek's IO loop is overloaded.
This commit is contained in:
Arne Welzel 2025-04-16 16:59:05 +02:00
parent 6bd624d9b2
commit 011029addc
9 changed files with 45 additions and 10 deletions

View file

@ -214,9 +214,11 @@ public:
bool OnFinish(double network_time) override { return true; }
};
WebSocketEventDispatcher::WebSocketEventDispatcher() {
WebSocketEventDispatcher::WebSocketEventDispatcher(std::string ident, size_t queue_size) {
onloop =
new zeek::detail::OnLoopProcess<WebSocketEventDispatcher, WebSocketEvent>(this, "WebSocketEventDispatcher");
new zeek::detail::OnLoopProcess<WebSocketEventDispatcher, WebSocketEvent>(this,
"WebSocketEventDispatcher:" + ident,
queue_size);
// Register the onloop instance the IO loop. Lifetime will be managed by the loop.
onloop->Register(false);