Timed process using GenServer asynchronously

Hi, I’m using the GenServer for my implementation. I need to send an asynchronous request with a timer, I’m using Process.send_after/3 for delayed process and handle it in handle_info callback. But is it asynchronous? I want to use GenServer.cast and handle_cast callback but I cant seem to set a delay for its execution.

Yes, Process.send_after/4 is asynchronous.

If you for some reason still want to use hanle_cast, spawn a Task that’ll sleep for 3 seconds and then send a cast.

2 Likes

@mudasobwa Thanks! I’ll be sticking in Process.send_after.