feat(dashboard): extract inline script to standalone dashboard.ts/js, add UI build/check recipes, and add route unit tests
This commit is contained in:
1 parent
4b307b55b9
commit
19f9c7ace7
24 files changed
+2343
-1819
No files matched your search
+7
-3
@@ -98,7 +98,7 @@ pub struct AppState {
|
||||
|
||||
pub async fn ttl_sweeper_worker(state: Arc<MemoryState>) {
|
||||
loop {
|
||||
tokio::time::sleep(Duration::from_secs(3600)).await;
|
||||
state.ttl_notify.notified().await;
|
||||
let now = std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.unwrap_or_default()
|
||||
@@ -121,7 +121,7 @@ pub async fn ttl_sweeper_worker(state: Arc<MemoryState>) {
|
||||
|
||||
pub async fn index_committer_worker(state: Arc<MemoryState>) {
|
||||
loop {
|
||||
tokio::time::sleep(Duration::from_secs(5)).await;
|
||||
state.index_commit_notify.notified().await;
|
||||
let idx_opt = state.search_index.read().ok().map(|idx| idx.clone());
|
||||
if let Some(idx) = idx_opt {
|
||||
let _ = idx.commit().await;
|
||||
@@ -131,7 +131,7 @@ pub async fn index_committer_worker(state: Arc<MemoryState>) {
|
||||
|
||||
pub async fn condense_graph_worker(state: Arc<MemoryState>) {
|
||||
loop {
|
||||
tokio::time::sleep(Duration::from_secs(3600)).await;
|
||||
state.condense_notify.notified().await;
|
||||
|
||||
let threshold: usize = std::env::var("MCP_MEMORY_CONDENSE_THRESHOLD")
|
||||
.unwrap_or_else(|_| "100".to_string())
|
||||
@@ -659,6 +659,10 @@ mod tests {
|
||||
let handle2 = tokio::spawn(index_committer_worker(state.clone()));
|
||||
let handle3 = tokio::spawn(condense_graph_worker(state.clone()));
|
||||
|
||||
state.ttl_notify.notify_one();
|
||||
state.index_commit_notify.notify_one();
|
||||
state.condense_notify.notify_one();
|
||||
|
||||
tokio::time::sleep(Duration::from_millis(50)).await;
|
||||
|
||||
handle1.abort();
|
||||
|
||||
Reference in new issue
Block a user