Skip to content

Commit

Permalink
Merge pull request #815 from thiamsantos/ts-user-node-name-to-avoid-d…
Browse files Browse the repository at this point in the history
…uplicated-messages-1.5

Use node_name to check if the message is local - 1.5
  • Loading branch information
benwilson512 committed Dec 7, 2019
2 parents 9d6cb0e + 28179ce commit 0e1f75a
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions lib/absinthe/subscription/proxy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ defmodule Absinthe.Subscription.Proxy do
{:ok, %__MODULE__{pubsub: pubsub, node: node_name, task_super: task_super}}
end

def handle_info(%{node: src_node}, %{node: node} = state) when src_node == node do
{:noreply, state}
end

def handle_info(:gc, state) do
:erlang.garbage_collect()
Process.send_after(self(), :gc, @gc_interval)
Expand All @@ -47,11 +43,13 @@ defmodule Absinthe.Subscription.Proxy do
# There's no meaningful form of backpressure to have here, and we can't
# bottleneck execution inside each proxy process

Task.Supervisor.start_child(state.task_super, Subscription.Local, :publish_mutation, [
state.pubsub,
payload.mutation_result,
payload.subscribed_fields
])
unless payload.node == state.pubsub.node_name() do
Task.Supervisor.start_child(state.task_super, Subscription.Local, :publish_mutation, [
state.pubsub,
payload.mutation_result,
payload.subscribed_fields
])
end

{:noreply, state}
end
Expand Down

0 comments on commit 0e1f75a

Please sign in to comment.