mirror of
https://github.com/wassname/talk.git
synced 2026-07-27 11:28:12 +08:00
updated pubsub
This commit is contained in:
+6
-6
@@ -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;
|
||||
};
|
||||
|
||||
@@ -74,8 +74,6 @@ const createClient = () => {
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
connectionOptions,
|
||||
attachMonitors,
|
||||
createClient,
|
||||
createClientFactory: () => {
|
||||
let client = null;
|
||||
|
||||
Reference in New Issue
Block a user