Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
chore: remove connect-calls for ioredis
Browse files Browse the repository at this point in the history
  • Loading branch information
hoeppner-dataport committed Apr 2, 2024
1 parent 43fc1b1 commit 4fc7357
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/socket/socket/redis-adapter.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { IoAdapter } from '@nestjs/platform-socket.io';
import { Redis } from "ioredis";
import { Redis } from 'ioredis';
import { ServerOptions } from 'socket.io';
import { createAdapter } from '@socket.io/redis-adapter';

export class RedisIoAdapter extends IoAdapter {
private adapterConstructor: ReturnType<typeof createAdapter>;

async connectToRedis(): Promise<void> {
const pubClient = new Redis(process.env.REDIS_URI || `redis://localhost:6379`);
const pubClient = new Redis(
process.env.REDIS_URI || `redis://localhost:6379`,
);
const subClient = pubClient.duplicate();

await Promise.all([pubClient.connect(), subClient.connect()]);
await Promise.all([pubClient, subClient]);

this.adapterConstructor = createAdapter(pubClient, subClient);
}
Expand Down

0 comments on commit 4fc7357

Please sign in to comment.