You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@justindotpub has shared their experience of running Electric alongside a Phoenix app on Discord.
One pain point from it that we could improve is to let the Phoenix app drop and recreate the database while Electric keeps running in the background. For that, Electric must close its replication connection to free the database up to being dropped. This can be partially achieved by issuing a pg_terminate_backend() command to drop the Postgres' end of Electric's replication connection:
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'hello_electric_dev'
AND pid <> pg_backend_pid();
However, Electric reconnects before Ecto has time to drop the database.
I'm proposing that we delay Electric's reconnection attempt if it sees that the connection was closed on purpose. Here's what the closure looks like on Electric's side:
@justindotpub has shared their experience of running Electric alongside a Phoenix app on Discord.
One pain point from it that we could improve is to let the Phoenix app drop and recreate the database while Electric keeps running in the background. For that, Electric must close its replication connection to free the database up to being dropped. This can be partially achieved by issuing a
pg_terminate_backend()
command to drop the Postgres' end of Electric's replication connection:However, Electric reconnects before Ecto has time to drop the database.
I'm proposing that we delay Electric's reconnection attempt if it sees that the connection was closed on purpose. Here's what the closure looks like on Electric's side:
The text was updated successfully, but these errors were encountered: