I have a genserver that is taking messages from a websocket and passing them to an event handler. The event handler receives a map from the genserver and takes action where appropriate. So for example, in response to a new user create event, the event handler would check if the user's email address comes from a suspicious domain, and if so, take some actions to reduce abuse.
So in event_handler.ex
you can see that when a new message comes in for a user create event, I pass the message
to UserHandler.handle_suspicious_domain
. That function returns the same map which I pass to UserHandler.handle_suspicious_ip
. But
I'm not sure if that's idomatic since I'm not transforming the map, I'm just passing it from function to function.
Then you can see in user_handler.ex
that I take the domain name through a set of transformations and then make a decision.
Looking at line 25 you can see that I have a function that does nothing and only exists to prevent a crash. That seems wasteful and