mail based rss feed aggregator
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

rename `backend.restart_feed` to `backend.reset_feed` it now 'resets' a paused feed by - decreasing the `repeated_failures` by 1 - setting next_check to right now - and restarting the fetcher for it

ollie d672c032 7b7b7bd7

+32 -10
+17 -7
src/eater/backend.gleam
··· 219 219 process.receive(send_to, within: 1000) 220 220 } 221 221 222 - /// restart the fetcher for this feed 222 + /// reset the fetcher for this feed 223 223 /// 224 - pub fn restart_feed(backend backend: Reference, feed feed: rss.Location) -> Nil { 224 + /// resets the failure count and restarts it 225 + /// 226 + pub fn reset_feed(backend backend: Reference, feed feed: rss.Location) { 227 + let feed = rss.reset(feed) 228 + 229 + use _ <- result.try(database.update_feed_repeated_failures( 230 + backend.database, 231 + feed, 232 + )) 233 + 225 234 let backend = process.named_subject(backend.name) 226 - process.send(backend, RestartFeed(feed)) 235 + process.send(backend, ResetFeed(feed)) 236 + |> Ok 227 237 } 228 238 229 239 /// trigger an early refetch for this feed ··· 342 352 343 353 /// restart the fetcher for this feed 344 354 /// 345 - RestartFeed(rss.Location) 355 + ResetFeed(rss.Location) 346 356 347 357 /// trigger an early refetch for this feed 348 358 /// ··· 372 382 Status(send_to: _) -> [ 373 383 woof.field("message", "Status"), 374 384 ] 375 - RestartFeed(feed) -> [ 376 - woof.field("message", "RestartFeed"), 385 + ResetFeed(feed) -> [ 386 + woof.field("message", "ResetFeed"), 377 387 woof.field("feed-id", feed.id |> uuid.to_string()), 378 388 woof.field("feed-url", feed.link |> uri.to_string()), 379 389 ] ··· 442 452 RemoveSubscription(user, feed) -> 443 453 handle_remove_subscription(state, user, feed) 444 454 Status(send_to: _) -> todo as "get status of system" 445 - RestartFeed(feed) -> { 455 + ResetFeed(feed) -> { 446 456 fetcher.restart_for(state.names.fetcher_manager, feed) 447 457 actor.continue(state) 448 458 }
+12
src/eater/feed/rss.gleam
··· 130 130 pub fn is_fetching_paused(feed: Location) { 131 131 feed.repeated_failures > 10 132 132 } 133 + 134 + /// reset a `Location` 135 + /// 136 + /// if `rss.is_fetching_paused` the failure count will only be decreased by 1 137 + /// 138 + pub fn reset(feed: Location) -> Location { 139 + case feed.repeated_failures { 140 + 10 -> Location(..feed, repeated_failures: 9) 141 + _ -> feed 142 + } 143 + |> next_check_in(duration.milliseconds(0)) 144 + }
+3 -3
src/eater/fetcher.gleam
··· 261 261 262 262 actor.continue(state) 263 263 } 264 - RestartFor(user) -> { 265 - process.send(state.self, StopFor(user)) 266 - process.send(state.self, StartFor(user)) 264 + RestartFor(feed) -> { 265 + process.send(state.self, StopFor(feed)) 266 + process.send(state.self, StartFor(feed)) 267 267 268 268 actor.continue(state) 269 269 }