From a2536eb41b0ee4099c2464462782fcfbd4e4e149 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Wed, 30 Aug 2017 09:06:48 -0600 Subject: [PATCH] updated pubsub --- package.json | 2 +- services/pubsub.js | 12 ++++++------ services/redis.js | 2 -- yarn.lock | 39 +++++++++++++++++---------------------- 4 files changed, 24 insertions(+), 31 deletions(-) diff --git a/package.json b/package.json index 34d0363a6..594153b7e 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "graphql": "^0.9.1", "graphql-docs": "^0.2.0", "graphql-errors": "^2.1.0", - "graphql-redis-subscriptions": "^1.1.5", + "graphql-redis-subscriptions": "^1.3.0", "graphql-server-express": "^0.6.0", "graphql-subscriptions": "^0.4.3", "graphql-tag": "^1.2.3", diff --git a/services/pubsub.js b/services/pubsub.js index 9fc2ae902..afd31ce06 100644 --- a/services/pubsub.js +++ b/services/pubsub.js @@ -1,5 +1,5 @@ const {RedisPubSub} = require('graphql-redis-subscriptions'); -const {connectionOptions, attachMonitors} = require('./redis'); +const {createClient} = require('./redis'); /** * getClient returns the pubsub singleton for this instance. @@ -10,11 +10,11 @@ const getClient = () => { return pubsub; } - pubsub = new RedisPubSub({connection: connectionOptions}); - - // Attach the node monitors to the subscriber + publishers. - attachMonitors(pubsub.redisPublisher); - attachMonitors(pubsub.redisSubscriber); + // Create the new PubSub client, we only need one per instance of Talk. + pubsub = new RedisPubSub({ + publisher: createClient(), + subscriber: createClient(), + }); return pubsub; }; diff --git a/services/redis.js b/services/redis.js index 72d2d3343..027d5bc20 100644 --- a/services/redis.js +++ b/services/redis.js @@ -74,8 +74,6 @@ const createClient = () => { }; module.exports = { - connectionOptions, - attachMonitors, createClient, createClientFactory: () => { let client = null; diff --git a/yarn.lock b/yarn.lock index 171ebb4c2..f68f7d314 100644 --- a/yarn.lock +++ b/yarn.lock @@ -362,7 +362,7 @@ async@2.4.1: dependencies: lodash "^4.14.0" -async@^2.0.1, async@^2.1.2, async@^2.1.4: +async@^2.1.2, async@^2.1.4: version "2.5.0" resolved "https://registry.yarnpkg.com/async/-/async-2.5.0.tgz#843190fd6b7357a0b9e1c956edddd5ec8462b54d" dependencies: @@ -2492,7 +2492,7 @@ es6-promise@3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.2.1.tgz#ec56233868032909207170c39448e24449dd1fc4" -es6-promise@^3.0.2, es6-promise@^3.2.1: +es6-promise@^3.0.2: version "3.3.1" resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.3.1.tgz#a08cdde84ccdbf34d027a1451bc91d4bcd28a613" @@ -3336,13 +3336,14 @@ graphql-errors@^2.1.0: babel-runtime "^6.6.1" uuid "^2.0.2" -graphql-redis-subscriptions@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/graphql-redis-subscriptions/-/graphql-redis-subscriptions-1.1.5.tgz#69166bebd8d92243d6f8e80c97ebf4c588d80c8d" +graphql-redis-subscriptions@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/graphql-redis-subscriptions/-/graphql-redis-subscriptions-1.3.0.tgz#bbc52b0f77bf7d50945c6bf4e8b8aba5135555b4" dependencies: - async "^2.0.1" - graphql-subscriptions "^0.2.0" - redis "^2.6.3" + graphql-subscriptions "^0.4.2" + iterall "^1.1.1" + optionalDependencies: + ioredis "^3.1.2" graphql-server-core@^0.6.0: version "0.6.0" @@ -3364,11 +3365,13 @@ graphql-server-module-graphiql@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/graphql-server-module-graphiql/-/graphql-server-module-graphiql-0.6.0.tgz#e37634b05f000731981e8ed13103f9a5861e5da0" -graphql-subscriptions@^0.2.0: - version "0.2.3" - resolved "https://registry.yarnpkg.com/graphql-subscriptions/-/graphql-subscriptions-0.2.3.tgz#75f9a02cb6d2b456b1703ce95670f793dacee607" +graphql-subscriptions@^0.4.2: + version "0.4.4" + resolved "https://registry.yarnpkg.com/graphql-subscriptions/-/graphql-subscriptions-0.4.4.tgz#39cff32d08dd3c990113864bab77154403727e9b" dependencies: - es6-promise "^3.2.1" + "@types/graphql" "^0.9.1" + es6-promise "^4.0.5" + iterall "^1.1.1" graphql-subscriptions@^0.4.3: version "0.4.3" @@ -3822,7 +3825,7 @@ invert-kv@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" -ioredis@^3.1.4: +ioredis@^3.1.2, ioredis@^3.1.4: version "3.1.4" resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-3.1.4.tgz#8688293f5f2f1757e1c812ad17cce49f46d811bc" dependencies: @@ -6724,7 +6727,7 @@ redis-commands@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/redis-commands/-/redis-commands-1.3.1.tgz#81d826f45fa9c8b2011f4cd7a0fe597d241d442b" -redis-parser@^2.0.0, redis-parser@^2.4.0, redis-parser@^2.6.0: +redis-parser@^2.0.0, redis-parser@^2.4.0: version "2.6.0" resolved "https://registry.yarnpkg.com/redis-parser/-/redis-parser-2.6.0.tgz#52ed09dacac108f1a631c07e9b69941e7a19504b" @@ -6732,14 +6735,6 @@ redis@^0.12.1: version "0.12.1" resolved "https://registry.yarnpkg.com/redis/-/redis-0.12.1.tgz#64df76ad0fc8acebaebd2a0645e8a48fac49185e" -redis@^2.6.3: - version "2.8.0" - resolved "https://registry.yarnpkg.com/redis/-/redis-2.8.0.tgz#202288e3f58c49f6079d97af7a10e1303ae14b02" - dependencies: - double-ended-queue "^2.1.0-0" - redis-commands "^1.2.0" - redis-parser "^2.6.0" - redis@~2.6.0-2: version "2.6.5" resolved "https://registry.yarnpkg.com/redis/-/redis-2.6.5.tgz#87c1eff4a489f94b70871f3d08b6988f23a95687"