Use ingest time as primary time and ioc time as alternative
This commit is contained in:
@@ -76,7 +76,6 @@ const IOC_PING_IVL: Duration = Duration::from_millis(1000 * 80);
|
||||
const DO_RATE_CHECK: bool = false;
|
||||
const MONITOR_POLL_TIMEOUT: Duration = Duration::from_millis(6000);
|
||||
const TIMEOUT_CHANNEL_CLOSING: Duration = Duration::from_millis(8000);
|
||||
const TIMEOUT_MONITOR_PASSIVE: Duration = Duration::from_millis(1000 * 68);
|
||||
const TIMEOUT_PONG_WAIT: Duration = Duration::from_millis(10000);
|
||||
|
||||
#[allow(unused)]
|
||||
@@ -115,6 +114,15 @@ macro_rules! trace_flush_queue {
|
||||
};
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
macro_rules! trace_event_incoming {
|
||||
($($arg:tt)*) => {
|
||||
if false {
|
||||
trace!($($arg)*);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Debug, ThisError)]
|
||||
pub enum Error {
|
||||
NoProtocol,
|
||||
@@ -1591,7 +1599,13 @@ impl CaConn {
|
||||
stnow: SystemTime,
|
||||
stats: &CaConnStats,
|
||||
) -> Result<(), Error> {
|
||||
// debug!("event_add_ingest payload_len {} value {:?}", payload_len, value);
|
||||
trace_event_incoming!(
|
||||
"event_add_ingest payload_len {} value {:?} {} {}",
|
||||
payload_len,
|
||||
value,
|
||||
value.status,
|
||||
value.severity
|
||||
);
|
||||
crst.ts_alive_last = tsnow;
|
||||
crst.ts_activity_last = tsnow;
|
||||
crst.item_recv_ivl_ema.tick(tsnow);
|
||||
@@ -1778,8 +1792,8 @@ impl CaConn {
|
||||
ReadingState::EnableMonitoring(_) => {}
|
||||
ReadingState::Monitoring(st3) => match &st3.mon2state {
|
||||
Monitoring2State::Passive(st4) => {
|
||||
if st4.tsbeg + TIMEOUT_MONITOR_PASSIVE < tsnow {
|
||||
trace2!("check_channels_state_poll Monitoring2State::Passive timeout");
|
||||
if st4.tsbeg + conf.conf.manual_poll_on_quiet_after() < tsnow {
|
||||
debug!("check_channels_state_poll Monitoring2State::Passive timeout");
|
||||
// TODO encapsulate and unify with Polling handler
|
||||
let ioid = Ioid(self.ioid);
|
||||
self.ioid = self.ioid.wrapping_add(1);
|
||||
|
||||
@@ -555,8 +555,8 @@ impl ChannelConfig {
|
||||
|
||||
/// Only used when in monitoring mode. If we do not see activity for this Duration then
|
||||
/// we issue a manual read to see if the channel is alive.
|
||||
pub fn manual_poll_on_quiet(&self) -> Duration {
|
||||
Duration::from_secs(120)
|
||||
pub fn manual_poll_on_quiet_after(&self) -> Duration {
|
||||
Duration::from_secs(300)
|
||||
}
|
||||
|
||||
pub fn expect_activity_within(&self) -> Duration {
|
||||
@@ -564,22 +564,22 @@ impl ChannelConfig {
|
||||
// It would be anyway invalid to be polled and specify a monitor record policy.
|
||||
match self.arch.short_term {
|
||||
Some(ChannelReadConfig::Poll(x)) => x,
|
||||
Some(ChannelReadConfig::Monitor) => self.manual_poll_on_quiet(),
|
||||
Some(ChannelReadConfig::Monitor) => self.manual_poll_on_quiet_after(),
|
||||
None => match self.arch.medium_term {
|
||||
Some(ChannelReadConfig::Poll(x)) => x,
|
||||
Some(ChannelReadConfig::Monitor) => self.manual_poll_on_quiet(),
|
||||
Some(ChannelReadConfig::Monitor) => self.manual_poll_on_quiet_after(),
|
||||
None => match self.arch.long_term {
|
||||
Some(ChannelReadConfig::Poll(x)) => x,
|
||||
Some(ChannelReadConfig::Monitor) => self.manual_poll_on_quiet(),
|
||||
Some(ChannelReadConfig::Monitor) => self.manual_poll_on_quiet_after(),
|
||||
None => {
|
||||
// This is an invalid configuration, so just a fallback
|
||||
self.manual_poll_on_quiet()
|
||||
self.manual_poll_on_quiet_after()
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
} else {
|
||||
self.manual_poll_on_quiet()
|
||||
self.manual_poll_on_quiet_after()
|
||||
};
|
||||
dur + Duration::from_millis(1000 * 10)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user