View Source Electric.Connection.Supervisor (electric v0.9.5)

The connection supervisor is a rest-for-one supervisor that starts Connection.Manager, followed by Replication.Supervisor.

Connection.Manager monitors all of the connection process that it starts and if any one of the goes down with a critical error (such as Postgres shutting down), the connection manager itself will shut down. This will cause the shutdown of Replication.Supervisor, due to the nature of the rest-for-one supervision strategy, and, since the latter supervisor is started as a temporary child of the connection supervisor, it won't be restarted until its child spec is re-added by a new call to start_shapes_supervisor/0.

This supervision design is deliberate: none of the "shapes" processes can function without a working DB pool and we only have a DB pool when the Connection.Manager process can see that all of its database connections are healthy. Connection.Manager tries to reopen connections when they are closed, with an exponential backoff, so it is the first process to know when a connection has been restored and it's also the one that starts Replication.Supervisor once it has successfully initialized a database connection pool.

Summary

Functions

Returns a specification to start this module under a supervisor.

Callback implementation for Supervisor.init/1.

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Callback implementation for Supervisor.init/1.

Link to this function

start_shapes_supervisor(opts)

View Source