Fix UpdateExecStats not sent to the main broker in centralized

This commit is contained in:
Dongjia "toka" Zhang 2024-03-25 16:39:30 +01:00 committed by GitHub
parent 3cc8ea0336
commit 7170b5391b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -292,6 +292,7 @@ where
) -> Result<(), Error> { ) -> Result<(), Error> {
if !self.is_main { if !self.is_main {
// secondary node // secondary node
let mut is_tc = false;
let is_nt_or_heartbeat = match &mut event { let is_nt_or_heartbeat = match &mut event {
Event::NewTestcase { Event::NewTestcase {
input: _, input: _,
@ -304,19 +305,26 @@ where
forward_id, forward_id,
} => { } => {
*forward_id = Some(ClientId(self.inner.mgr_id().0 as u32)); *forward_id = Some(ClientId(self.inner.mgr_id().0 as u32));
is_tc = true;
true true
} }
Event::UpdateExecStats { Event::UpdateExecStats {
time: _, time: _,
executions: _, executions: _,
phantom: _, phantom: _,
} => true, } => true, // send it but this guy won't be handled. the only purpose is to keep this client alive else the broker thinks it is dead and will dc it
_ => false, _ => false,
}; };
if is_nt_or_heartbeat { if is_nt_or_heartbeat {
return self.forward_to_main(&event); self.forward_to_main(&event)?;
if is_tc {
// early return here because we only send it to centralized not main broker.
return Ok(());
}
} }
} }
// now inner llmp manager will process it
self.inner.fire(state, event) self.inner.fire(state, event)
} }