···237237 :noop
238238239239 {_expires, timed_out_pid} ->
240240- {_check_fun, %Resume{} = resume} = Map.fetch!(state.awaiting_message, timed_out_pid)
240240+ {{_check_fun, %Resume{} = resume}, awaiting_message} = Map.pop!(state.awaiting_message, timed_out_pid)
241241242242 # Resume the timed out process with a timeout message
243243 # The process will then call exit(:timeout) (see await_resume/1)
244244 state = monitor_current(state, resume.pid)
245245 send resume.pid, {:timeout, resume.ref}
246246247247- # Clean up the timeout
248248- state = purge_timeouts(state, timed_out_pid)
247247+ # Clean up the timeout and await
248248+ state =
249249+ %State{state | awaiting_message: awaiting_message}
250250+ |> purge_timeouts(timed_out_pid)
249251 {:performed, state}
250252 end
251253 end