@@ -30,17 +30,29 @@ impl MissingEventFetcher {
3030 }
3131
3232 /// Run the thread
33- #[ instrument( skip( self ) , ret) ]
33+ #[ instrument( name = "missing-event-fetcher" , skip( self ) , ret) ]
3434 pub async fn run ( self ) {
35+ let mut initial_followers = {
36+ let Ok ( db) = self . client . db ( ) else {
37+ return ;
38+ } ;
39+ db
40+ }
41+ . get_followees ( self . self_id )
42+ . await ;
3543 let mut ids_with_missing_events_rx = self . ids_with_missing_events_rx . clone ( ) ;
3644
3745 loop {
38- let author_id = match ids_with_missing_events_rx. recv ( ) . await {
39- Ok ( id) => id,
40- Err ( dedup_chan:: RecvError :: Closed ) => break ,
41- Err ( dedup_chan:: RecvError :: Lagging ) => {
42- warn ! ( target: LOG_TARGET , "Missing event fetcher missed some notifications" ) ;
43- continue ;
46+ let author_id = if let Some ( initial_follower_id) = initial_followers. pop ( ) {
47+ initial_follower_id. 0
48+ } else {
49+ match ids_with_missing_events_rx. recv ( ) . await {
50+ Ok ( id) => id,
51+ Err ( dedup_chan:: RecvError :: Closed ) => break ,
52+ Err ( dedup_chan:: RecvError :: Lagging ) => {
53+ warn ! ( target: LOG_TARGET , "Missing event fetcher missed some notifications" ) ;
54+ continue ;
55+ }
4456 }
4557 } ;
4658 trace ! ( target: LOG_TARGET , "Woke up" ) ;
@@ -52,6 +64,7 @@ impl MissingEventFetcher {
5264 let followers = db. get_followers ( author_id) . await ;
5365 let missing_events = db. get_missing_events_for_id ( author_id) . await ;
5466
67+ debug ! ( target: LOG_TARGET , len=missing_events. len( ) , id=%author_id, "Missing events for id" ) ;
5568 if missing_events. is_empty ( ) {
5669 continue ;
5770 }
0 commit comments