mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-24 22:03:54 +00:00
4.8.8 test fix (#2149)
* perf: code comment * feat: system plugin input guide * perf: variable avatar * feat: feishu webhook * perf: select tool config tip * perf: rename variable * fix: per inherit error * perf: docker-compose oneapi version and i18n * perf: ui tip bug * fix: ts * perf: pg log * perf: editor color * perf: update init
This commit is contained in:
@@ -47,8 +47,6 @@ const addCommonMiddleware = (schema: mongoose.Schema) => {
|
||||
|
||||
if (duration > 1000) {
|
||||
addLog.warn(`Slow operation ${duration}ms`, warnLogData);
|
||||
} else if (duration > 3000) {
|
||||
addLog.error(`Slow operation ${duration}ms`, warnLogData);
|
||||
}
|
||||
}
|
||||
next();
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import { delay } from '@fastgpt/global/common/system/utils';
|
||||
import { addLog } from '../system/log';
|
||||
import { connectionMongo } from './index';
|
||||
import type { Mongoose } from 'mongoose';
|
||||
@@ -17,9 +18,11 @@ export async function connectMongo(): Promise<Mongoose> {
|
||||
try {
|
||||
connectionMongo.set('strictQuery', true);
|
||||
|
||||
connectionMongo.connection.on('error', (error) => {
|
||||
connectionMongo.connection.on('error', async (error) => {
|
||||
console.log('mongo error', error);
|
||||
connectionMongo.disconnect();
|
||||
await connectionMongo.disconnect();
|
||||
await delay(1000);
|
||||
connectMongo();
|
||||
});
|
||||
connectionMongo.connection.on('disconnected', () => {
|
||||
console.log('mongo disconnected');
|
||||
@@ -44,8 +47,10 @@ export async function connectMongo(): Promise<Mongoose> {
|
||||
|
||||
console.log('mongo connected');
|
||||
} catch (error) {
|
||||
connectionMongo.disconnect();
|
||||
addLog.error('mongo connect error', error);
|
||||
await connectionMongo.disconnect();
|
||||
await delay(1000);
|
||||
connectMongo();
|
||||
}
|
||||
|
||||
return connectionMongo;
|
||||
|
Reference in New Issue
Block a user