File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
redisinsight/api/src/modules/database-analysis Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,10 @@ export class DatabaseAnalysisService {
29
29
clientMetadata : ClientMetadata ,
30
30
dto : CreateDatabaseAnalysisDto ,
31
31
) : Promise < DatabaseAnalysis > {
32
+ let client ;
33
+
32
34
try {
33
- const client = await this . databaseConnectionService . createClient ( clientMetadata ) ;
35
+ client = await this . databaseConnectionService . createClient ( clientMetadata ) ;
34
36
35
37
const scanResults = await this . scanner . scan ( client , {
36
38
filter : dto . filter ,
@@ -54,8 +56,10 @@ export class DatabaseAnalysisService {
54
56
progress,
55
57
} , [ ] . concat ( ...scanResults . map ( ( nodeResult ) => nodeResult . keys ) ) ) ) ;
56
58
59
+ client . disconnect ( ) ;
57
60
return this . databaseAnalysisProvider . create ( analysis ) ;
58
61
} catch ( e ) {
62
+ client ?. disconnect ( ) ;
59
63
this . logger . error ( 'Unable to analyze database' , e ) ;
60
64
61
65
if ( e instanceof HttpException ) {
You can’t perform that action at this time.
0 commit comments