Skip to content

Commit

Permalink
change ioredis version to 4.28.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Wiaderek authored and Tomasz Wiaderek committed Nov 13, 2023
1 parent 2c590b4 commit 079ca95
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 42 deletions.
8 changes: 4 additions & 4 deletions apps/server/src/infra/ioredis/ioredis.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import Redis from 'ioredis';

if (Configuration.has('REDIS_URI')) {
const redisUrl: string = Configuration.get('REDIS_URI') as string;
const ioredis: Redis.Redis = new Redis(redisUrl);
const ioredisClient = new Redis(redisUrl);

ioredis.on('error', (error) => logger.error(error));
ioredis.on('connect', (msg) => logger.log(msg));
ioredisClient.on('error', (error) => logger.error(error));
ioredisClient.on('connect', (msg) => logger.log(msg));

return ioredis;
return ioredisClient;
}

return undefined;
Expand Down
6 changes: 3 additions & 3 deletions apps/server/src/modules/tldraw/redis/redis.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as IoRedis from 'ioredis';
import Redis from 'ioredis';
import { WsSharedDocDo } from '@modules/tldraw/domain/ws-shared-doc.do';

export const getDocUpdatesKey = (doc: WsSharedDocDo) => `doc:${doc.name}:updates`;

export const getDocUpdatesFromQueue = async (redis: IoRedis.Redis, doc: WsSharedDocDo) =>
export const getDocUpdatesFromQueue = async (redis: Redis.Redis, doc: WsSharedDocDo) =>
redis.lrangeBuffer(getDocUpdatesKey(doc), 0, -1);

export const pushDocUpdatesToQueue = async (redis: IoRedis.Redis, doc: WsSharedDocDo, update: Uint8Array) => {
export const pushDocUpdatesToQueue = async (redis: Redis.Redis, doc: WsSharedDocDo, update: Uint8Array) => {
const len = await redis.llen(getDocUpdatesKey(doc));
if (len > 100) {
void redis
Expand Down
6 changes: 3 additions & 3 deletions apps/server/src/modules/tldraw/service/tldraw.ws.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Buffer } from 'node:buffer';
import { getDocUpdatesFromQueue, pushDocUpdatesToQueue } from '@src/modules/tldraw/redis';
import { applyUpdate, Doc } from 'yjs';
import { IOREDIS } from '@infra/ioredis';
import * as ioRedis from 'ioredis';
import Redis from 'ioredis';

@Injectable()
export class TldrawWsService {
Expand All @@ -27,8 +27,8 @@ export class TldrawWsService {
constructor(
private readonly configService: ConfigService<TldrawConfig, true>,
private readonly tldrawBoardRepo: TldrawBoardRepo,
@Inject(IOREDIS) private readonly pub: ioRedis.Redis,
@Inject(IOREDIS) readonly sub: ioRedis.Redis
@Inject(IOREDIS) private readonly pub: Redis.Redis,
@Inject(IOREDIS) readonly sub: Redis.Redis
) {
this.pingTimeout = this.configService.get<number>('TLDRAW_PING_TIMEOUT');
this.mux = mutex.createMutex();
Expand Down
66 changes: 35 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
"html-entities": "^2.3.2",
"i18next": "^23.3.0",
"i18next-fs-backend": "^2.1.5",
"ioredis": "^5.3.2",
"ioredis": "^4.28.5",
"jose": "^1.28.1",
"jsonwebtoken": "^9.0.0",
"jwks-rsa": "^2.0.5",
Expand Down

0 comments on commit 079ca95

Please sign in to comment.