cpursley / walex

Postgres change events (CDC) in Elixir
MIT License
276 stars 14 forks source link

Small tweaks #63

Closed DaemonSnake closed 3 months ago

DaemonSnake commented 3 months ago

small PR with some tweaks / fixes

The main one would be 3123c3f9f6d289c8768d3df8b77ca75dccd608b2 In WalEx.Supervisor, it inverses the order of Replication and Destination in the supervisor tree. We had to as, without this, this error occurs quite often when the app shutsdown:

ErlangError: ** (ErlangError) Erlang error: {:noproc, {GenServer, :call, [{:via, Registry, {:walex_registry, {WalEx.Destinations, App}}}, {:process, %WalEx.Changes.Transaction{changes: [], commit_timestamp: ~U[2024-05-17 13:57:59.109094Z]}, App}, :infinity]}}
lib/gen_server.ex:1103 in GenServer.call/3
lib/walex/replication/publisher.ex:69 in WalEx.Replication.Publisher.handle_cast/2
gen_server.erl:1121 in :gen_server.try_handle_cast/3
gen_server.erl:1183 in :gen_server.handle_msg/6

As the Replication casts to Destination the first Supervisor to start and stop should be Replication.

Another change is e3ae63dacb9d440176c5e0da7013f5d892240be7 that adds a child_spec function to WalEx.Config.Registry so that the end user can add the registry to his own Supervisor tree if need be.

cpursley commented 3 months ago

Thanks!

DaemonSnake commented 3 months ago

thanks @cpursley ^^