Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Let it crash is kind of overstated for Erlang too. Sure, a supervised process will restart, but you'll lose the message queue. For a gen_server that's mostly stateless (or that's mostly servicing state in mnesia or similar), it ends up being less disruptive to catch in handle_call around your real work, so a crash only throws away the one request.

Caveat: in the environment I work, we don't do real gen_server:call, because all of the included monitor/demonitor calls are too expensive for us. The trade-off is we only have timeouts when the server goes away during the request. If you had the monitor letting you know the request crashed the server, you could presumably do a smartish retry -- but it's still nicer to only need to do that for the crashing request, not the others that would fail simply because the server died.



Depends on the scenario of course, but when working with Elixir I tend not to use GenServers much as well. I mostly handle problems with idempotent and at-least-once-executed tasks. Works quite well 99% of the time.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: