Files
talk/services/pubsub.js
T
Wyatt Johnson 745c579b82 Adjust redis to not start during webpack build
- Added new WEBPACK env var which is enabled during yarn build scripts
- Defered redis starting until listen is called
- Moved pubsub to a factory pattern init
- Async/Await'ed the routes
- Moved pubsub handle for routes into middleware
- Adjusted redis cache and job processors to have lazy connection
starting
- Disabled mongo from auto-connecting on require
- Adjusted package redis clients to act as factory singletons instead
2017-07-17 13:34:04 -06:00

15 lines
278 B
JavaScript

const {RedisPubSub} = require('graphql-redis-subscriptions');
const {connectionOptions} = require('./redis');
let pubsub = null;
module.exports = () => {
if (pubsub) {
return pubsub;
}
pubsub = new RedisPubSub({connection: connectionOptions});
return pubsub;
};