@@ -1952,10 +1952,7 @@ pub async fn dashboard_snapshot(State(state): State<Arc<AppState>>) -> impl Into
19521952 dm_override. as_ref ( ) ,
19531953 )
19541954 } ;
1955- let mut agent_entries_visible: Vec < _ > = agent_entries
1956- . iter ( )
1957- . filter ( |e| !e. is_hand )
1958- . collect ( ) ;
1955+ let mut agent_entries_visible: Vec < _ > = agent_entries. iter ( ) . filter ( |e| !e. is_hand ) . collect ( ) ;
19591956 // Sort by last_active descending — matches AgentsPage default query order.
19601957 agent_entries_visible. sort_by ( |a, b| b. last_active . cmp ( & a. last_active ) ) ;
19611958 let agents: Vec < serde_json:: Value > = agent_entries_visible
@@ -1968,21 +1965,26 @@ pub async fn dashboard_snapshot(State(state): State<Arc<AppState>>) -> impl Into
19681965 static SKILL_COUNT_CACHE : std:: sync:: Mutex < Option < ( usize , std:: time:: Instant ) > > =
19691966 std:: sync:: Mutex :: new ( None ) ;
19701967 let skill_count = {
1971- let cached = SKILL_COUNT_CACHE . lock ( ) . unwrap_or_else ( |p| p. into_inner ( ) ) . as_ref ( ) . and_then ( |( n, t) | {
1972- if t. elapsed ( ) < std:: time:: Duration :: from_secs ( 30 ) {
1973- Some ( * n)
1974- } else {
1975- None
1976- }
1977- } ) ;
1968+ let cached = SKILL_COUNT_CACHE
1969+ . lock ( )
1970+ . unwrap_or_else ( |p| p. into_inner ( ) )
1971+ . as_ref ( )
1972+ . and_then ( |( n, t) | {
1973+ if t. elapsed ( ) < std:: time:: Duration :: from_secs ( 30 ) {
1974+ Some ( * n)
1975+ } else {
1976+ None
1977+ }
1978+ } ) ;
19781979 match cached {
19791980 Some ( n) => n,
19801981 None => {
19811982 let skills_dir = state. kernel . home_dir ( ) . join ( "skills" ) ;
19821983 let mut registry = librefang_skills:: registry:: SkillRegistry :: new ( skills_dir) ;
19831984 let _ = registry. load_all ( ) ;
19841985 let n = registry. list ( ) . len ( ) ;
1985- * SKILL_COUNT_CACHE . lock ( ) . unwrap_or_else ( |p| p. into_inner ( ) ) = Some ( ( n, std:: time:: Instant :: now ( ) ) ) ;
1986+ * SKILL_COUNT_CACHE . lock ( ) . unwrap_or_else ( |p| p. into_inner ( ) ) =
1987+ Some ( ( n, std:: time:: Instant :: now ( ) ) ) ;
19861988 n
19871989 }
19881990 }
0 commit comments