Files
FastGPT/packages/service/core/dataset/training/controller.ts
Archer 62e87551ac New dpcs structure and dataset i18n (#551)
* perf: check balance

* md

* lock way

* i18n

* docs

* doc

* i18n

* update doc

* feat: one link sync

* feat: one link sync

* feat: one link sync

* feat: one link sync

* feat: one link sync

* feat: one link sync

* feat: one link sync
2023-12-04 21:37:07 +08:00

22 lines
520 B
TypeScript

import { delay } from '@fastgpt/global/common/system/utils';
import { MongoDatasetTraining } from './schema';
export const lockTrainingDataByTeamId = async (teamId: string, retry = 3): Promise<any> => {
try {
await MongoDatasetTraining.updateMany(
{
teamId
},
{
lockTime: new Date('2999/5/5')
}
);
} catch (error) {
if (retry > 0) {
await delay(1000);
return lockTrainingDataByTeamId(teamId, retry - 1);
}
return Promise.reject(error);
}
};