mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 12:08:20 +00:00
Fix how cluster framework tracks worker count
This commit is contained in:
parent
186d47c762
commit
95ea84e60e
1 changed files with 10 additions and 2 deletions
|
@ -238,6 +238,8 @@ export {
|
|||
global node_topic: function(name: string): string;
|
||||
}
|
||||
|
||||
global active_worker_ids: set[string] = set();
|
||||
|
||||
type NamedNode: record {
|
||||
name: string;
|
||||
node: Node;
|
||||
|
@ -305,7 +307,10 @@ event Cluster::hello(name: string, id: string) &priority=10
|
|||
Cluster::log(fmt("got hello from %s (%s)", name, id));
|
||||
|
||||
if ( n$node_type == WORKER )
|
||||
++worker_count;
|
||||
{
|
||||
add active_worker_ids[id];
|
||||
worker_count = |active_worker_ids|;
|
||||
}
|
||||
}
|
||||
|
||||
event Broker::peer_added(endpoint: Broker::EndpointInfo, msg: string) &priority=10
|
||||
|
@ -329,7 +334,10 @@ event Broker::peer_lost(endpoint: Broker::EndpointInfo, msg: string) &priority=1
|
|||
delete n$id;
|
||||
|
||||
if ( n$node_type == WORKER )
|
||||
--worker_count;
|
||||
{
|
||||
delete active_worker_ids[endpoint$id];
|
||||
worker_count = |active_worker_ids|;
|
||||
}
|
||||
|
||||
event Cluster::node_down(node_name, endpoint$id);
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue