{"action":"created","issue":{"url":"https://api.github.com/repos/Shopify/graphql-batch/issues/90","repository_url":"https://api.github.com/repos/Shopify/graphql-batch","labels_url":"https://api.github.com/repos/Shopify/graphql-batch/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/Shopify/graphql-batch/issues/90/comments","events_url":"https://api.github.com/repos/Shopify/graphql-batch/issues/90/events","html_url":"https://github.com/Shopify/graphql-batch/issues/90","id":347745193,"node_id":"MDU6SXNzdWUzNDc3NDUxOTM=","number":90,"title":"Does not work across multiplexed queries","user":{"login":"TSMMark","id":4197823,"node_id":"MDQ6VXNlcjQxOTc4MjM=","avatar_url":"https://avatars1.githubusercontent.com/u/4197823?v=4","gravatar_id":"","url":"https://api.github.com/users/TSMMark","html_url":"https://github.com/TSMMark","followers_url":"https://api.github.com/users/TSMMark/followers","following_url":"https://api.github.com/users/TSMMark/following{/other_user}","gists_url":"https://api.github.com/users/TSMMark/gists{/gist_id}","starred_url":"https://api.github.com/users/TSMMark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TSMMark/subscriptions","organizations_url":"https://api.github.com/users/TSMMark/orgs","repos_url":"https://api.github.com/users/TSMMark/repos","events_url":"https://api.github.com/users/TSMMark/events{/privacy}","received_events_url":"https://api.github.com/users/TSMMark/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-08-06T00:30:55Z","updated_at":"2018-08-20T13:48:49Z","closed_at":null,"author_association":"NONE","body":"This library is fantastic and thanks for publishing it!\r\n\r\nIn my testing, IDs are not always aggregated across multiple queries when `Schema#multiplex` is used. The promises do resolve correctly, but one DB query is made per multiplexed gql query.\r\n\r\n[I found a test in this repo](https://github.com/Shopify/graphql-batch/blob/69a14c58dc27ab0f16fe55b99d51210dda0bd253/test/multiplex_test.rb#L23), which runs queries with `multiplex` and uses `QueryNotifier.subscriber` to assert that only 1 query is made, but my loader does not behave.\r\n\r\nCurrent gem versions:\r\n\r\n```ruby\r\ngem \"graphql\", \"=1.6.0\"\r\ngem \"graphql-batch\", \"=0.3.9\"\r\n```\r\n\r\nThe loader in question is very simple:\r\n\r\n```ruby\r\nmodule Loaders\r\n  class Single < ::GraphQL::Batch::Loader\r\n\r\n    attr_reader :model, :options, :key\r\n\r\n    def initialize(model_arg, options_arg = {})\r\n      @model = model_arg\r\n      @options = options_arg\r\n      @key = options.fetch(:key, :id)\r\n    end\r\n\r\n    def perform(ids)\r\n      model.where(key => ids).all.each(&method(:fulfill_record))\r\n      ids.reject(&method(:fulfilled?)).each(&method(:fulfill_nil))\r\n    end\r\n\r\n    private\r\n\r\n    def fulfill_record(record)\r\n      fulfill(record.send(key), record)\r\n    end\r\n\r\n    def fulfill_nil(id)\r\n      fulfill(id, nil)\r\n    end\r\n\r\n  end\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/Shopify/graphql-batch/issues/comments/414322587","html_url":"https://github.com/Shopify/graphql-batch/issues/90#issuecomment-414322587","issue_url":"https://api.github.com/repos/Shopify/graphql-batch/issues/90","id":414322587,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNDMyMjU4Nw==","user":{"login":"dylanahsmith","id":954402,"node_id":"MDQ6VXNlcjk1NDQwMg==","avatar_url":"https://avatars3.githubusercontent.com/u/954402?v=4","gravatar_id":"","url":"https://api.github.com/users/dylanahsmith","html_url":"https://github.com/dylanahsmith","followers_url":"https://api.github.com/users/dylanahsmith/followers","following_url":"https://api.github.com/users/dylanahsmith/following{/other_user}","gists_url":"https://api.github.com/users/dylanahsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/dylanahsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dylanahsmith/subscriptions","organizations_url":"https://api.github.com/users/dylanahsmith/orgs","repos_url":"https://api.github.com/users/dylanahsmith/repos","events_url":"https://api.github.com/users/dylanahsmith/events{/privacy}","received_events_url":"https://api.github.com/users/dylanahsmith/received_events","type":"User","site_admin":false},"created_at":"2018-08-20T13:48:49Z","updated_at":"2018-08-20T13:48:49Z","author_association":"MEMBER","body":"graphql-batch is database independent.  Query multiplexing happens in the same thread, so it shouldn't cause new thread-safety issues.  If it doesn't just work, then try to isolate the issue to report the issue to the appropriate project with instructions on how to reproduce the issue."}}
{"actor":{"display_login":"dylanahsmith"}}