-
Notifications
You must be signed in to change notification settings - Fork 64
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
Starting two different subscriptions at the same time throws "an operation already exists with this id" #90
Comments
I'm with the same problem. Add a delay doesn't feel like a good thing. Maybe it is related to what was told here? UpdateI've tried adding some delay and in my case only works with 1 second which is pretty bad to wait. |
In my case the app listens to 20 tables. I had a query that worked perfectly. Then I converted it into a subscription and ran into the fact that a subscription can only query one root field (http://spec.graphql.org/June2018/#sec-Single-root-field). So I rebuilt into 20 separate subscriptions. And ran into this issue:
Seems like a killer for my app 😢 |
I can reproduce this error:
|
I looked at the code. And wondered if the key passed could be the issue (https://github.com/Flutterando/hasura_connect/blob/master/lib/src/presenter/hasura_connect_base.dart#L177). But passing in own keys does not change the behaviour. |
I found the reason for this issue: When creating a subscription hasura_connect checks if a connection already exists. If not, it creates it before returning the snapshot. But it returns the snapshot without awaiting the connection to be established: https://github.com/Flutterando/hasura_connect/blob/master/lib/src/presenter/hasura_connect_base.dart#L204. I created a pull request to await the connection to be established: #99 You can use my branch in the meantime (based on v3.0.4): hasura_connect:
git:
url: https://github.com/barbalex/hasura_connect
ref: master |
Im testing in v1.3.2 Hasura, and i cant get the error :C I add the test on playground.dart file in test folder @barbalex can u simulate that? |
At least, in version "4.0.0+4" I am still having this problem. |
Problem
In my app, I start two different subscriptions with two different queries at the start of the app (i.e., one listens for messages and one listens for notifications). Doing so for some reason throws the following error
A simple code to reproduce:
(In my app, I have them in separate places but they pretty much start at the same time)
a workaround:
adding some delay before one of the subscriptions makes solve the problem but it's not optimal (I found 300ms to be a good delay, anything lower will throw the error).
The text was updated successfully, but these errors were encountered: