chiark / gitweb /
Replace an assert with sensible handling.
authorSimon Tatham <anakin@pobox.com>
Sun, 31 Dec 2023 13:25:07 +0000 (13:25 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 31 Dec 2023 13:25:07 +0000 (13:25 +0000)
It came up the first time I tried to test on a dev instance.

src/client.rs

index 6a366c2fa3b2cc7b22dc005de80105b1f3e6388d..da6fdd52d80ffece1d3a32705d515d2cfea3daa9 100644 (file)
@@ -325,8 +325,15 @@ impl Client {
                 return Ok(false);
             }
         } else {
-            assert!(self.feeds.contains_key(id),
-                    "Shouldn't be extending a feed we've never fetched")
+            if !self.feeds.contains_key(id) {
+                // We might be called on to extend a feed that we've
+                // not yet fetched for the first time, if a streaming
+                // notification comes in before the user has yet taken
+                // us into the activity reading that feed. If so,
+                // ignore the event; the _actual_ initial fetch will
+                // deal with it later.
+                return Ok(false);
+            }
         }
 
         let req = match id {