Skip to content

Commit

Permalink
fix(electric): Use the same TCP options for epgsql and Ecto connectio…
Browse files Browse the repository at this point in the history
…ns (#1292)

Fixes #1278.

I have verified this fix by building a custom Docker image for this
commit and deploying it to a DigitalOcean droplet that has IPv6
connectivity. The sync service connected to Supabase, the Ecto repo pool
initialized successfully.
  • Loading branch information
alco committed Jun 4, 2024
1 parent fdc9a75 commit e8e4e3b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/thin-impalas-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@core/electric": patch
---

Use the same TCP options for database connections regardless of whether they are initiated by epgsql or the Ecto repo.
3 changes: 3 additions & 0 deletions components/electric/lib/electric/postgres/repo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ defmodule Electric.Postgres.Repo do
password: conn_opts.password,
database: conn_opts.database,
ssl: conn_opts.ssl == :required,
# Pass TCP options to the Postgrex adapter. This is used to let the adapter know to
# connect to the DB using IPv6, for example.
socket_options: Map.get(conn_opts, :tcp_opts, []),
pool_size: Keyword.get(opts, :pool_size, @default_pool_size),
log: false,
after_connect: {__MODULE__, :set_display_settings, []}
Expand Down

0 comments on commit e8e4e3b

Please sign in to comment.