@@ -64,7 +64,7 @@ export class WAMonitoringService {
6464 throw new NotFoundException ( `Instance "${ instanceName } " not found` ) ;
6565 }
6666
67- const clientName = await this . configService . get < Database > ( 'DATABASE' ) . CONNECTION . CLIENT_NAME ;
67+ const clientName = this . configService . get < Database > ( 'DATABASE' ) . CONNECTION . CLIENT_NAME ;
6868
6969 const where = instanceName ? { name : instanceName , clientName } : { clientName } ;
7070
@@ -122,17 +122,17 @@ export class WAMonitoringService {
122122 where : { name : instanceName } ,
123123 } ) ;
124124
125- if ( ! findInstance ) this . logger . error ( 'Instance not found' ) ;
126-
127- const instance = await this . prismaRepository . instance . update ( {
128- where : { name : instanceName } ,
129- data : { connectionStatus : 'close' } ,
130- } ) ;
125+ if ( findInstance ) {
126+ const instance = await this . prismaRepository . instance . update ( {
127+ where : { name : instanceName } ,
128+ data : { connectionStatus : 'close' } ,
129+ } ) ;
131130
132- rmSync ( join ( INSTANCE_DIR , instance . id ) , { recursive : true , force : true } ) ;
131+ rmSync ( join ( INSTANCE_DIR , instance . id ) , { recursive : true , force : true } ) ;
133132
134- instanceDbId = instance . id ;
135- await this . prismaRepository . session . deleteMany ( { where : { sessionId : instance . id } } ) ;
133+ instanceDbId = instance . id ;
134+ await this . prismaRepository . session . deleteMany ( { where : { sessionId : instance . id } } ) ;
135+ }
136136 }
137137
138138 if ( this . redis . REDIS . ENABLED && this . redis . REDIS . SAVE_INSTANCES ) {
0 commit comments