The handle_info callback won’t complete until it does. If it takes longer than your @ms_sleep_interval then all that Process.send_after does it put something in the GenServer’s mailbox, but the GenServer won’t handle it until the prior handle_info returns.
Thank you for your insights. That takes about four seconds to complete. How could I go about unblocking the GenServer so that it processes the Process.send_after message before Python.call() completes?
You can’t technically do that as you asked. You need to understand that GenServers are sequential. They do one thing at a time – pull one message from the mailbox, execute the logic related to that, then look at the next message in the mailbox. However, your handle_info callback could launch another process, such as a Task to do the work in a separate process. That way you have multiple processes doing things concurrently.