chiark / gitweb /
Fetch the two main feeds on startup.
authorSimon Tatham <anakin@pobox.com>
Thu, 4 Jan 2024 19:55:13 +0000 (19:55 +0000)
committerSimon Tatham <anakin@pobox.com>
Thu, 4 Jan 2024 19:55:13 +0000 (19:55 +0000)
Mostly, this fixes missing message beeps. But it also means the UI
won't pause annoyingly the first time I go to one of those feeds.

src/tui.rs

index ef3db9423418a5e477eeb601129ac1b9de81c642..99829a57d9e1f80eaf4f68ed5d13e931421cc9b9 100644 (file)
@@ -17,7 +17,9 @@ use std::fs::File;
 use unicode_width::UnicodeWidthStr;
 
 use super::activity_stack::*;
-use super::client::{Client, ClientError, FeedId, StreamId, StreamUpdate};
+use super::client::{
+    Client, ClientError, FeedId, FeedExtend, StreamId, StreamUpdate,
+};
 use super::coloured_string::{ColouredString, ColouredStringSlice};
 use super::config::ConfigLocation;
 use super::menu::*;
@@ -304,6 +306,15 @@ impl Tui {
             }))?;
         }
 
+        // Now fetch the two basic feeds - home and mentions. Most
+        // importantly, getting the mentions feed started means that
+        // we can spot updates to it after that.
+        //
+        // We must do this _after_ starting the stream listener, so
+        // that we won't miss a notification due to a race condition.
+        self.client.fetch_feed(&FeedId::Home, FeedExtend::Initial)?;
+        self.client.fetch_feed(&FeedId::Mentions, FeedExtend::Initial)?;
+
         self.main_loop()
     }