File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export class ServiceProvider {
15
15
this . _clientInstance = new Client ( ) ;
16
16
}
17
17
18
- static async initialize ( ) : Promise < ServiceProvider | null > {
18
+ static async initialize ( ) : Promise < ServiceProvider | null > {
19
19
if ( ! ServiceProvider . instance ) {
20
20
const instance = new ServiceProvider ( ) ;
21
21
const isInitialized = await instance . _clientInstance . initialize ( ) ;
@@ -85,21 +85,18 @@ export class ServiceProvider {
85
85
86
86
for ( let attempt = 0 ; attempt < retries ; attempt ++ ) {
87
87
try {
88
- logger . warn ( `Database connection attempt ${ attempt + 1 } ...` , 'Database' ) ;
89
- return await fn ( ) ; // Try executing the provided function
88
+ return await fn ( ) ;
90
89
} catch ( error : any ) {
91
90
lastError = error ;
92
91
logger . warn ( `Retry Attempt ${ attempt + 1 } failed with error: ${ error . message || error } .` , 'Database' ) ;
93
-
94
92
if ( attempt < retries - 1 ) {
95
- const backoffTime = delay * Math . pow ( 2 , attempt ) ; // Exponential backoff
93
+ const backoffTime = delay * Math . pow ( 2 , attempt ) ;
96
94
logger . warn ( `Retrying in ${ backoffTime } ms...` , 'Database' ) ;
97
95
await new Promise ( ( res ) => setTimeout ( res , backoffTime ) ) ;
98
96
}
99
97
}
100
98
}
101
-
102
99
logger . error ( `All ${ retries } retry attempts failed. Last error: ${ lastError ?. message || lastError } ` , 'Database' ) ;
103
- return null ; // Return null if all retries fail
100
+ return null ;
104
101
}
105
102
}
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ export class MessagesService {
13
13
}
14
14
private isText ( ) : boolean {
15
15
if ( ! this . _ctx . message ?. text ) {
16
- logger . warn ( 'Message text is undefined' ) ;
17
16
return false ;
18
17
}
19
18
return true ;
You can’t perform that action at this time.
0 commit comments