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

Method code_projects_seen_within

src/global_db.rs:1562–1591  ·  view source on GitHub ↗

Returns registered code projects whose `last_seen_at` is within the last `since_secs` seconds, most-recently-seen first, capped at `limit`. Used by the git-metadata watcher to register only projects seen recently (e.g. within 14 days), bounded by `watch_max_projects`.

(
        &self,
        since_secs: i64,
        limit: usize,
    )

Source from the content-addressed store, hash-verified

1560 /// Used by the git-metadata watcher to register only projects seen recently
1561 /// (e.g. within 14 days), bounded by `watch_max_projects`.
1562 pub async fn code_projects_seen_within(
1563 &self,
1564 since_secs: i64,
1565 limit: usize,
1566 ) -> Vec<CodeProjectRecord> {
1567 let limit = i64::try_from(limit).unwrap_or(i64::MAX);
1568 let cutoff = crate::tracedecay::current_timestamp().saturating_sub(since_secs);
1569 let Ok(mut rows) = self
1570 .conn
1571 .query(
1572 "SELECT project_id, canonical_root, display_root, git_common_dir,
1573 git_remote_url, default_branch, created_at, last_seen_at
1574 FROM code_projects
1575 WHERE last_seen_at >= ?1
1576 ORDER BY last_seen_at DESC, project_id
1577 LIMIT ?2",
1578 params![cutoff, limit],
1579 )
1580 .await
1581 else {
1582 return Vec::new();
1583 };
1584 let mut projects = Vec::new();
1585 while let Ok(Some(row)) = rows.next().await {
1586 if let Some(project) = row_to_code_project(&row, 0) {
1587 projects.push(project);
1588 }
1589 }
1590 projects
1591 }
1592
1593 /// Removes registered code-project rows by exact project id.
1594 ///

Callers 2

spawnMethod · 0.80

Calls 3

current_timestampFunction · 0.85
row_to_code_projectFunction · 0.85
pushMethod · 0.80