This seems ok, because at least it’s async to the user liking the message, but now all “notification_events” (let’s say those are
:liked_messageand:message_reply) are handled sequentially.
This is a fact, but whether it’s a problem or not depends on your specific use case.
For instance, it provides a free guarantee that notifications are handled in precisely the order transmitted.
def handle_info({:liked_message, msg}, state) do
Task.start(__MODULE__, :create_notification_here, [msg])
{:noreply, state}
end
Be careful with patterns like this - if a LOT of messages come in at once, there’s no limit on how many processes this tries to start. Consider using something like :poolboy to get parallel workers with bounded resource consumption.






















