[erlang-questions] handling crash on db connect

Garrett Smith <>
Thu Jun 6 21:28:21 CEST 2013


On Thu, Jun 6, 2013 at 2:01 PM, Paul Rubin <> wrote:
> On Thu, Jun 6, 2013 at 9:49 AM, Garrett Smith <> wrote:
>
>> I didn't implement any of the start functions for the client process.
>> It's arguably bad form to not implement parallel start functions to
>> each start_link -- but the cases where start_link is *wrong* are quite
>> rare (none occur to me actually :)
>
> start_link seems wrong to me in this case, but I still find OTP somewhat
> murky so I can't claim to have that good intuition about what it should or
> shouldn't do.

My fault -- I didn't make this clear at all!

In fact, when there's a connect error from the client, you *will* get
an error result (e.g. {error,{connect,econnrefused}}). However,
because the calling process is linked, you never see it -- you crash.

I'll add the start functions to redis_client and use those instead
with redis:connect (which is just a facade anyway -- arguably you
should use redis_client:start/start_link directly).

This will be much less surprising :)

Garrett



More information about the erlang-questions mailing list