Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Many subscription events in quick succession - some events are skipped #886

Closed
marktani opened this issue Oct 18, 2017 · 6 comments
Closed

Comments

@marktani
Copy link
Contributor

From @sorenbs on March 31, 2017 15:28

In the playground, start a simple subscription:

subscription{
  Issue{
    node{
      id
    }
  }
}

In a new playground tab, manually execute a mutation 12 times in a row.

mutation {
  createIssue(d: B, date: "2020", published: true, title: "lala"){
    id
    title
  }
}

Observe that only 8 events appear in the playground, even though the websocket actually receive all 12 events:

image

Copied from original issue: graphcool/console#799

@mwickett
Copy link

I think this is more than just a playground issue. I'm seeing this happening with a subscription based function in our application where a different function (operation) sets multiple records in a different collection to true. We have subscription function firing on updates to that field, and it's the incoming data stream is missing some of the records.

@marktani
Copy link
Contributor Author

Hey @mwickett can you create a separate issue for this? If you could nail it down to a small minimal reproduction, that would be much appreciated, too! 🙂

@mwickett
Copy link

I believe I sorted out an issue with my function, so false alarm. Sorry about that!

@lewisblackwood
Copy link

Hey @marktani - I've observed this issue in the playground too. But I've also observed another issue with subscriptions that's causing us problems.

If I toggle a boolean field on one of my records, then the node returned in the subscription does not always contain the correct data. For example, my Hire type has a boolean field sessionsAddedToCalendar. If I register the subscription:

subscription updatedHire {
  Hire(
    filter: {
      mutation_in: [UPDATED]
    }
  ) {
    mutation
    node {
      sessionsAddedToCalendar
    }
  }
}

and toggle the field in the console, I'm often seeing playground output like this:

{
  "data": {
    "Hire": {
      "mutation": "UPDATED",
      "node": {
        "sessionsAddedToCalendar": false
      }
    }
  }
}

{
  "data": {
    "Hire": {
      "mutation": "UPDATED",
      "node": {
        "sessionsAddedToCalendar": true
      }
    }
  }
}

{
  "data": {
    "Hire": {
      "mutation": "UPDATED",
      "node": {
        "sessionsAddedToCalendar": true
      }
    }
  }
}

{
  "data": {
    "Hire": {
      "mutation": "UPDATED",
      "node": {
        "sessionsAddedToCalendar": true
      }
    }
  }
}

{
  "data": {
    "Hire": {
      "mutation": "UPDATED",
      "node": {
        "sessionsAddedToCalendar": false
      }
    }
  }
}

I don't think events have been skipped - the total number is correct. It's that the updated node doesn't reflect the correct information. It should go false -> true -> false -> true -> false.

Is there any way to fix this? We've only noticed it recently, but it's causing lots of inconsistencies on our client app 😬

@marktani
Copy link
Contributor Author

marktani commented Nov 3, 2017

Hey @lewisblackwood just saw this - could you please provide a reproduction for this in a new issue? 🙂

@marktani
Copy link
Contributor Author

This issue has been moved to graphcool/graphcool-framework.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants