File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
adminforth/dataConnectors Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -8,16 +8,17 @@ const { Client } = pkg;
88
99class PostgresConnector extends AdminForthBaseConnector implements IAdminForthDataSourceConnector {
1010
11- async setupClient ( url ) : Promise < void > {
11+ async setupClient ( url : string ) : Promise < void > {
1212 this . client = new Client ( {
1313 connectionString : url
1414 } ) ;
1515 try {
1616 await this . client . connect ( ) ;
17- this . client . on ( 'error' , ( err ) => {
17+ this . client . on ( 'error' , async ( err ) => {
1818 console . log ( 'Postgres error: ' , err . message , err . stack )
1919 this . client . end ( ) ;
20- this . client = new PostgresConnector ( { url } ) . db ;
20+ await new Promise ( ( resolve ) => { setTimeout ( resolve , 1000 ) } ) ;
21+ this . setupClient ( url ) ;
2122 } ) ;
2223 } catch ( e ) {
2324 throw new Error ( `Failed to connect to Postgres ${ e } ` ) ;
You can’t perform that action at this time.
0 commit comments