chore: mutex task message of import and export (#4834)

This commit is contained in:
ChengLei Shao 2024-07-06 22:00:05 +08:00 committed by GitHub
parent 2de6e2d0cc
commit 4b2ac3eeb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 4 deletions

View File

@ -1,4 +1,5 @@
{
"Export warning": "每次最多导出 {{limit}} 行数据,超出的将被忽略。",
"Start export": "开始导出"
"Start export": "开始导出",
"another export action is running, please try again later.": "另一导出任务正在运行,请稍后重试。"
}

View File

@ -54,7 +54,11 @@ async function exportXlsxAction(ctx: Context, next: Next) {
export async function exportXlsx(ctx: Context, next: Next) {
if (mutex.isLocked()) {
throw new Error(`another export action is running, please try again later.`);
throw new Error(
ctx.t(`another export action is running, please try again later.`, {
ns: 'action-export',
}),
);
}
const release = await mutex.acquire();

View File

@ -25,5 +25,6 @@
"Incorrect date format": "日期格式不正确",
"Incorrect email format": "邮箱格式不正确",
"Illegal percentage format": "百分比格式有误",
"Imported template does not match, please download again.": "导入模板不匹配,请检查导入文件标题行或重新下载导入模板"
"Imported template does not match, please download again.": "导入模板不匹配,请检查导入文件标题行或重新下载导入模板",
"another import action is running, please try again later.": "另一导入任务正在运行,请稍后重试。"
}

View File

@ -59,7 +59,11 @@ async function importXlsxAction(ctx: Context, next: Next) {
export async function importXlsx(ctx: Context, next: Next) {
if (mutex.isLocked()) {
throw new Error(`another import action is running, please try again later.`);
throw new Error(
ctx.t(`another import action is running, please try again later.`, {
ns: 'action-import',
}),
);
}
const release = await mutex.acquire();