MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / should_record

Method should_record

src/sessions/git_correlation.rs:364–372  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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`)

Callers 1

Calls 1

insertMethod · 0.80

Tested by

no test coverage detected