From 77f98c2438c41b6891914dd4b208a3c83681ea99 Mon Sep 17 00:00:00 2001 From: Davidson Gomes Date: Sun, 2 Jul 2023 20:17:13 -0300 Subject: [PATCH] Added destructor in redis connection --- src/db/redis.client.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/db/redis.client.ts b/src/db/redis.client.ts index 035ace54..921bb0b4 100644 --- a/src/db/redis.client.ts +++ b/src/db/redis.client.ts @@ -79,4 +79,20 @@ export class RedisCache { this.logger.error(error); } } + + public async closeConnection() { + try { + await this.client.quit(); + } catch (error) { + this.logger.error(error); + } + } + + public async destructor() { + await this.closeConnection(); + } + + public async destroy() { + await this.destructor(); + } }