Electric.Connection.Restarter (electric v1.2.4)
View SourceGen server responsible for shutting down and restarting the connection subsystem.
It makes sure to update StatusMonitor with the current subsystem state to maintain correct behaviour of other components of the system that depend on the database availability, such as:
- HTTP API server processing shape requests
- publication manager
- schema reconciler
Summary
Functions
Returns a specification to start this module under a supervisor.
Callback implementation for GenServer.init/1.
Restart the connection subsystem.
Restore the connection subsystem after it had been stopped by stop_connection_subsystem/1.
Stop the connection subsystem, closing all database connections.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Callback implementation for GenServer.init/1.
Restart the connection subsystem.
Restore the connection subsystem after it had been stopped by stop_connection_subsystem/1.
Implementation notes
To restore the subsystem, the Shapes.Supervisor is stopped first before getting
restarted by the Connection.Manager later. The Connection.Manager itself is started
via a Supervisor.restart_child() call.
Stop the connection subsystem, closing all database connections.
This lets the database server scale its compute to zero if it supports this feature and has no other sessions.
Inside Electric, the shape subsystem keeps running.
Implementation notes
Currently, this function stops only the Connection.Manager process which shuts down all types of database connections linked to it. When a new shape request arrives, it will immediately stop the Shapes.Supervisor and restart the Connection.Manager, which then in turn starts a fresh Shapes.Supervisor again.