From 409150813d7c13a09d5a9a8df4b4d42f2a5b869f Mon Sep 17 00:00:00 2001 From: mattwr18 Date: Mon, 10 Feb 2020 17:19:19 +0100 Subject: [PATCH] Update to use PubSub in development - for some reason RedisPubSub works locally, but with docker it tries to connect to Redis and therefore it doesn't pass the build. PubSub is imported from graphql-subscriptions which is a dependency of apollo-server-express, and suitable for dev purposes. --- backend/src/server.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/src/server.js b/backend/src/server.js index 4c02b8ddb..d64ee72f1 100644 --- a/backend/src/server.js +++ b/backend/src/server.js @@ -2,7 +2,6 @@ import express from 'express' import http from 'http' import helmet from 'helmet' import { ApolloServer } from 'apollo-server-express' - import CONFIG from './config' import middleware from './middleware' import { getNeode, getDriver } from './db/neo4j' @@ -10,6 +9,7 @@ import decode from './jwt/decode' import schema from './schema' import webfinger from './activitypub/routes/webfinger' import { RedisPubSub } from 'graphql-redis-subscriptions' +import { PubSub } from 'graphql-subscriptions' import Redis from 'ioredis' export const NOTIFICATION_ADDED = 'NOTIFICATION_ADDED' @@ -23,14 +23,13 @@ const options = { return Math.min(times * 50, 2000) }, } - if (options.host && options.port && options.password) { prodPubsub = new RedisPubSub({ publisher: new Redis(options), subscriber: new Redis(options), }) } else { - devPubsub = new RedisPubSub() + devPubsub = new PubSub() } export const pubsub = prodPubsub || devPubsub const driver = getDriver()