Today I Learned

A Hashrocket project

Ready to join Hashrocket? Find Openings here and apply today.

How to cancel a Process message in Elixir

TIL that we can cancel a Process.send_after/4 message before it happens by calling Process.cancel_timer/1:

ref = Process.send_after(self(), :process, 1000)

So we just need to keep the reference on your GenServer so we can possibly cancel later.

Thanks @mwoods79

Looking for help? At Hashrocket, we 💜 Elixir! From our many Elixir client projects, to sponsoring the Chicago Elixir Meetup, to the source code for this application, we are invested in this community. Contact us today to talk about your Elixir project.