From: Simon Tatham Date: Thu, 4 Jan 2024 19:55:13 +0000 (+0000) Subject: Fetch the two main feeds on startup. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=f4b7d79cbd36234d989784f0a090e1b23c808814;p=mastodonochrome.git Fetch the two main feeds on startup. 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. --- diff --git a/src/tui.rs b/src/tui.rs index ef3db94..99829a5 100644 --- a/src/tui.rs +++ b/src/tui.rs @@ -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() }