You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Using PG2 we have only one.
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.
The call to publish_remote already publishes the data to redis, and the local publish also publishes to redis. In my case, calling publish_remote/3 directly solved the issue, but I don't like very much relying on a internal function.
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: