File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export class ServiceProvider {
1515 this . _clientInstance = new Client ( ) ;
1616 }
1717
18- static async initialize ( ) : Promise < ServiceProvider | null > {
18+ static async initialize ( ) : Promise < ServiceProvider | null > {
1919 if ( ! ServiceProvider . instance ) {
2020 const instance = new ServiceProvider ( ) ;
2121 const isInitialized = await instance . _clientInstance . initialize ( ) ;
@@ -85,21 +85,18 @@ export class ServiceProvider {
8585
8686 for ( let attempt = 0 ; attempt < retries ; attempt ++ ) {
8787 try {
88- logger . warn ( `Database connection attempt ${ attempt + 1 } ...` , 'Database' ) ;
89- return await fn ( ) ; // Try executing the provided function
88+ return await fn ( ) ;
9089 } catch ( error : any ) {
9190 lastError = error ;
9291 logger . warn ( `Retry Attempt ${ attempt + 1 } failed with error: ${ error . message || error } .` , 'Database' ) ;
93-
9492 if ( attempt < retries - 1 ) {
95- const backoffTime = delay * Math . pow ( 2 , attempt ) ; // Exponential backoff
93+ const backoffTime = delay * Math . pow ( 2 , attempt ) ;
9694 logger . warn ( `Retrying in ${ backoffTime } ms...` , 'Database' ) ;
9795 await new Promise ( ( res ) => setTimeout ( res , backoffTime ) ) ;
9896 }
9997 }
10098 }
101-
10299 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 ;
104101 }
105102}
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ export class MessagesService {
1313 }
1414 private isText ( ) : boolean {
1515 if ( ! this . _ctx . message ?. text ) {
16- logger . warn ( 'Message text is undefined' ) ;
1716 return false ;
1817 }
1918 return true ;
You can’t perform that action at this time.
0 commit comments