From 3cd2e280751aeae33b963395425d3b8826843735 Mon Sep 17 00:00:00 2001 From: gc <30398469+gc@users.noreply.github.com> Date: Wed, 24 Jul 2024 17:39:19 +1000 Subject: [PATCH] Add disconnect method --- dist/TSRedis.d.ts | 1 + dist/TSRedis.js | 3 +++ src/TSRedis.ts | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/dist/TSRedis.d.ts b/dist/TSRedis.d.ts index 1d3143f..fb99a8d 100644 --- a/dist/TSRedis.d.ts +++ b/dist/TSRedis.d.ts @@ -31,6 +31,7 @@ export declare class TSRedis { constructor(options?: RedisOptions & { mocked: boolean; }); + disconnect(): void; subscribe(callback: (message: Message) => void): void; publish(message: Message): void; } diff --git a/dist/TSRedis.js b/dist/TSRedis.js index cdc9d37..4683893 100644 --- a/dist/TSRedis.js +++ b/dist/TSRedis.js @@ -29,6 +29,9 @@ class TSRedis { }); this.redis = options.mocked ? new ioredis_mock_1.default(options) : new ioredis_1.default(options); } + disconnect() { + return this.redis.disconnect(); + } subscribe(callback) { this.redis.subscribe(CHANNEL_ID, (err, count) => { if (err) { diff --git a/src/TSRedis.ts b/src/TSRedis.ts index 2188c9c..b5c4395 100644 --- a/src/TSRedis.ts +++ b/src/TSRedis.ts @@ -26,6 +26,10 @@ export class TSRedis { this.redis = options.mocked ? new MockRedis(options) : new Redis(options); } + disconnect() { + return this.redis.disconnect(); + } + subscribe(callback: (message: Message) => void) { this.redis.subscribe(CHANNEL_ID, (err, count) => { if (err) {