mail based rss feed aggregator
2
fork

Configure Feed

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

make `fetcher.Message` public and return subject

ollie ab935ca9 7ed79883

+8 -7
+8 -7
src/eater/fetcher.gleam
··· 27 27 |> glight.with("module", "fetcher") 28 28 |> logging_helper.log_logger(level, message) 29 29 } 30 + 30 31 const interval_in_ms: Int = 3_600_000 31 32 32 33 /// the factory for the fetcher actors 33 34 /// 34 35 pub fn factory( 35 36 name: process.Name(_), 36 - ) -> supervision.ChildSpecification(factory.Supervisor(Start, Nil)) { 37 + ) -> supervision.ChildSpecification(factory.Supervisor(Start, _)) { 37 38 factory.worker_child(start) 38 39 |> factory.named(name) 39 40 |> factory.supervised() ··· 42 43 /// starts a fetcher for each known feed 43 44 /// 44 45 pub fn start_all_existing( 45 - factory: process.Name(factory.Message(Start, Nil)), 46 + factory: process.Name(factory.Message(Start, _)), 46 47 registry: process.Name(group_registry.Message(pubsub.Message)), 47 48 database: sqlight.Connection, 48 49 ) { ··· 67 68 pub fn start_new( 68 69 factory_name: process.Name(_), 69 70 with: Start, 70 - ) -> Result(actor.Started(Nil), actor.StartError) { 71 + ) -> Result(actor.Started(_), actor.StartError) { 71 72 let factory = factory.get_by_name(factory_name) 72 73 factory.start_child(factory, with) 73 74 } ··· 83 84 ) 84 85 } 85 86 86 - type Message { 87 + pub type Message { 87 88 CheckFeeds 88 89 } 89 90 ··· 103 104 104 105 /// starts a new fetcher child 105 106 /// 106 - fn start(args: Start) -> Result(actor.Started(Nil), actor.StartError) { 107 + fn start(args: Start) -> Result(actor.Started(_), actor.StartError) { 107 108 let Start(feed:, registry:, database:) = args 108 109 109 110 log(logging.Info, "Starting Fetcher for " <> feed.link) ··· 111 112 actor.new_with_initialiser(100, fn(subject) { 112 113 // TODO: persist the next timestamp to check at to the database 113 114 // so the actor restarting doesnt preeptively recheck the feed 114 - let fetch_timer = process.send_after(subject, 20, CheckFeeds) 115 + let fetch_timer = process.send_after(subject, 150, CheckFeeds) 115 116 116 117 actor.initialised(State( 117 118 self: subject, ··· 120 121 registry:, 121 122 database:, 122 123 )) 123 - |> actor.returning(Nil) 124 + |> actor.returning(subject) 124 125 |> Ok 125 126 }) 126 127 |> actor.on_message(on_message)