Skip to content

Commit

Permalink
Use process.sleep, as it does not block the beam
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephTLyons committed Nov 26, 2024
1 parent 1def330 commit 1dd672e
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/persevero.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub fn execute(
yielder: yielder,
operation: fn(_) { operation() },
allow: allow,
wait_function: wait_function,
wait_function: process.sleep,
).result
}

Expand Down Expand Up @@ -151,10 +151,3 @@ fn do_execute(
)
}
}

fn wait_function(wait_time wait_time: Int) -> Nil {
let subject = process.new_subject()
let _ = subject |> process.send_after(wait_time, Nil)
let _ = subject |> process.receive(within: wait_time * 2)
Nil
}

0 comments on commit 1dd672e

Please sign in to comment.