Skip to content

Commit cebc037

Browse files
author
Artem
committed
#RI-3986 possible fix to deal with concurrent requests (graceful shutdown)
1 parent ab18e33 commit cebc037

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

redisinsight/api/src/modules/redis/redis.service.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,14 @@ export class RedisService implements OnModuleDestroy {
7676
};
7777

7878
if (found) {
79-
found.client.disconnect();
79+
// workaround for concurrent requests.
80+
// At first try to gracefully close the connection using quit
81+
try {
82+
found.client.quit();
83+
} catch (e) {
84+
found.client.disconnect();
85+
}
86+
8087
this.clients.delete(id);
8188
this.clients.set(id, clientInstance);
8289
return 0; // todo: investigate why we need to distinguish between 1 | 0

0 commit comments

Comments
 (0)