diff --git a/package-lock.json b/package-lock.json index f644d0e..85dc2ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "falkordb", - "version": "6.2.3", + "version": "6.2.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "falkordb", - "version": "6.2.3", + "version": "6.2.4", "license": "MIT", "workspaces": [ "./packages/*" diff --git a/package.json b/package.json index 5751193..98ca626 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "falkordb", - "version": "6.2.3", + "version": "6.2.4", "description": "A FalkorDB javascript library", "license": "MIT", "main": "./dist/index.js", diff --git a/src/clients/sentinel.ts b/src/clients/sentinel.ts index 4306e57..baf38a0 100644 --- a/src/clients/sentinel.ts +++ b/src/clients/sentinel.ts @@ -19,6 +19,8 @@ function extractDetails(masters: Array>) { export class Sentinel extends Single { + private sentinelClient!: SingleGraphConnection; + init(falkordb: FalkorDB): Promise { const redisOption = (this.client.options ?? {}) as TypedRedisClientOptions; return this.tryConnectSentinelServer(this.client, redisOption, falkordb); @@ -50,6 +52,9 @@ export class Sentinel extends Single { }; const realClient = createClient<{ falkordb: typeof commands }, RedisFunctions, RedisScripts>(serverOptions) + // Save sentinel client to quit on quit() + this.sentinelClient = client; + // Set original client as sentinel and server client as client this.client = realClient; @@ -78,5 +83,16 @@ export class Sentinel extends Single { }) .connect(); } + + async quit() { + const promises = [ + super.quit() + ]; + if (this.sentinelClient) { + const reply = this.sentinelClient.quit(); + promises.push(reply.then(() => {})) + } + return Promise.all(promises).then(() => {}); + } }