MCPcopy Create free account
hub / github.com/concensure/Semantic / prune_error_patterns

Method prune_error_patterns

storage/src/lib.rs:1984–1993  ·  view source on GitHub ↗

Prune oldest error patterns when count exceeds max.

(&self, max: usize)

Source from the content-addressed store, hash-verified

1982
1983 /// Prune oldest error patterns when count exceeds max.
1984 pub fn prune_error_patterns(&self, max: usize) -> Result<()> {
1985 self.conn.execute(
1986 "DELETE FROM error_patterns WHERE id IN (
1987 SELECT id FROM error_patterns ORDER BY last_seen ASC
1988 LIMIT MAX(0, (SELECT COUNT(*) FROM error_patterns) - ?1)
1989 )",
1990 rusqlite::params![max as i64],
1991 )?;
1992 Ok(())
1993 }
1994
1995 /// List all error patterns ordered by hit_count desc.
1996 pub fn list_error_patterns(&self, limit: usize) -> Result<Vec<engine::ErrorPattern>> {

Callers 1

record_errorMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected