Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

after disconnecting the server from the internet it shuts down the DB then the whole app #251

Open
123mitnik opened this issue May 19, 2022 · 0 comments

Comments

@123mitnik
Copy link

123mitnik commented May 19, 2022

After following the documentation and setting up successfully the eventstore, here what happens if i disconnect from internet for about 2-3 minutes
note: this happens on osx with the mentioned at the end deps.

first it shuts down its own DB, then the main DB and finally it terminates the whole app..

defmodule App.EventStore.Subscriber do
  use GenServer
  alias App.EventStore.EventStore
  alias App.Accounts

  def start_link(_args) do
    GenServer.start_link(__MODULE__, [])
  end

  def received_events(subscriber) do
    GenServer.call(subscriber, :received_events)
  end

  def init(events) do
    # Subscribe to events from all streams
    {:ok, subscription} =
      EventStore.subscribe_to_all_streams("topic_subscription", self())

    {:ok, %{events: events, subscription: subscription}}
  end

  # Successfully subscribed to all streams
  def handle_info({:subscribed, subscription}, %{subscription: subscription} = state) do
    {:noreply, state}
  end

  # Event notification
  def handle_info({:events, events}, state) do
    %{events: existing_events, subscription: subscription} = state
...........

[debug] Subscription "topic_subscription"@"$all" subscriber #PID<0.818.0> down due to: :shutdown
[debug] Subscription "topic_subscription"@"$all" has no subscribers, shutting down
[debug] Monitored server Postgrex.Notifications terminate due to: :shutdown
[debug] Monitored server Postgrex terminate due to: :shutdown
[debug] Monitored server Postgrex terminate due to: :shutdown

Erlang/OTP 24 [erts-12.2.1] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1]
      {:phoenix, "~> 1.6.6"},
      {:phoenix_ecto, "~> 4.4"},
      {:eventstore, "~> 1.3"},
      {:phoenix_ecto, "~> 4.4"},
      {:ecto_sql, "~> 3.6"},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant