[erlang-questions] Dealing with "transient" external service (database)

David Welton davidw@REDACTED
Mon May 13 11:43:30 CEST 2013


Hi,

I'm thinking about what needs to be done for this Chicago Boss feature
request/improvement:

https://github.com/evanmiller/ChicagoBoss/issues/254

With the key point being that CB should start even if the database is not up.

It should also handle someone stopping the database and having it be
down for a few minutes.

I'm trying to think of how this should work in Erlang, as I'm not sure
it fits into the supervisor model.  What I want to happen (I think) is
something along these lines:

* boss_db, which handles db connections, starts up, and tries to
connect to the db driver/database itself.

* If it can't connect, it sets some kind of flag, and keeps trying at
intervals (possibly with exponential backoff until it hits a certain
maximum interval).

* Something similar happens if the connection goes down because the
database has been stopped for whatever reason.

* Attempts to use boss_db when things are not ok generate some kind of
specific error that can be dealt with in other parts of the system, in
order to at least inform the end user that there is something unusual
going on, in a nice way.

Sorry if this is all a bit fuzzy, but I think the general idea is
clear: a web site should continue to run, but give warnings that can
be defined by the user when the DB is down, rather than crash
completely.

--
David N. Welton

http://www.dedasys.com/



More information about the erlang-questions mailing list