Returns `true` (and records `ts` as the new watermark) when an observation at `ts` for this key should be written; returns `false` when a write for the same key happened within `min_interval_secs`. An out-of-order (older) `ts` never suppresses a write.
(&mut self, key: &str, ts: i64, min_interval_secs: i64)
| 362 | /// when a write for the same key happened within `min_interval_secs`. |
| 363 | /// An out-of-order (older) `ts` never suppresses a write. |
| 364 | pub fn should_record(&mut self, key: &str, ts: i64, min_interval_secs: i64) -> bool { |
| 365 | if let Some(&last) = self.last_write.get(key) { |
| 366 | if ts >= last && ts - last < min_interval_secs { |
| 367 | return false; |
| 368 | } |
| 369 | } |
| 370 | self.last_write.insert(key.to_string(), ts); |
| 371 | true |
| 372 | } |
| 373 | } |
| 374 | |
| 375 | /// Builds the debounce key for one observation. Detached HEAD (branch `None`) |
no test coverage detected