v4.2 (#217)
* fix: chat module link * fix: url fetch check * fix: import file ui * feat: app logs * perf: iframe icon * imgs cdn * perf: click range and pg
This commit is contained in:
@@ -2,7 +2,7 @@ import { Pool } from 'pg';
|
||||
import type { QueryResultRow } from 'pg';
|
||||
import { PgTrainingTableName } from '@/constants/plugin';
|
||||
|
||||
export const connectPg = async () => {
|
||||
export const connectPg = async (): Promise<Pool> => {
|
||||
if (global.pgClient) {
|
||||
return global.pgClient;
|
||||
}
|
||||
@@ -17,6 +17,7 @@ export const connectPg = async () => {
|
||||
global.pgClient.on('error', (err) => {
|
||||
console.log(err);
|
||||
global.pgClient = null;
|
||||
connectPg();
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -25,7 +26,7 @@ export const connectPg = async () => {
|
||||
return global.pgClient;
|
||||
} catch (error) {
|
||||
global.pgClient = null;
|
||||
return Promise.reject(error);
|
||||
return connectPg();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user