-
Notifications
You must be signed in to change notification settings - Fork 82
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
Messages duplicated when using phoenix_pubsub_redis as adapter #63
Comments
I did some investigation around this issue, and seems that the problem is been caused by this line. https://github.com/absinthe-graphql/absinthe/blob/master/lib/absinthe/subscription.ex#L83 The call to publish_remote already publishes the data to redis, and the local publish also publishes to redis. In my case, calling I would like to understand why we have this two publishes, one to remote and another to local, as when we use the redis adapter both publishes are "remote". It is something specific to a PG2 adapter? What should be the prefered approach for this? cc: @benwilson512 @bruce |
Hi @thiamsantos. I'll go into more detail tomorrow, but I think the real issue is this line here: https://github.com/absinthe-graphql/absinthe/blob/master/lib/absinthe/subscription/proxy.ex#L36. Phoenix PubSub doesn't provide a way to say "publish to every node that isn't this one", so I have to publish to every node, including this one, and then filter out messages that come from the current node. However my mechanism for doing so relies on a detail of how PG2 works, I should be using the Phoenix.Endpoint.node_name or whatever it's called. |
Whenever I published a message on a subscription it always publishes two messages instead of one. It only happens when the
phoenix_pubsub_redis
adapter is used for the pubsub. If I use the PG2 adapter the errors stops from happening.Using Redis as backend we have two messages been published:
![Screenshot at 2019-11-06 10-12-40](https://user-images.githubusercontent.com/13632762/68301811-83c82500-007f-11ea-8876-1d81db6a8145.png)
Using PG2 we have only one.
![Screenshot at 2019-11-06 10-14-05](https://user-images.githubusercontent.com/13632762/68301812-8460bb80-007f-11ea-97fc-c3976b913548.png)
The expected behaviour would be only one message been published.
I don't know if it is a issue with absinthe or with the redis adapter, but is a really strange behaviour.
I created a bootstrap phoenix project with the minimal to simulate the behaviour.
Versions:
Deps:
The text was updated successfully, but these errors were encountered: