#Function run periodically on an actor
1 messages · Page 1 of 1 (latest)
You can do a process.send_aftermessage sending it to the actor itself.
fn loop(
state: State,
msg: msg.ClientRequest(String),
) -> actor.Next(State, msg.ClientRequest(String)) {
case msg {
msg.SelfReq -> {
// Send request to service itself every 30 s
process.send_after(state.my_subject, 30_000, msg.SelfReq)
https://github.com/gleam-lang/packages/blob/main/src/packages/periodic.gleam
this one is pretty useful by louis
but yeah same concept as karlson mentioned
Thank you!