fix: 调整重连逻辑以增加每次连接尝试的延迟时间;更新 mvFile 方法以支持 'app-file' 类型

This commit is contained in:
2026-01-21 15:56:28 +08:00
parent 3f899dbd5f
commit a911334459
3 changed files with 10 additions and 7 deletions

View File

@@ -122,7 +122,7 @@ export class AssistantApp extends Manager {
} else {
setTimeout(() => {
this.reconnectRemoteApp();
}, 30 * 1000); // 30秒后重连
}, 30 * 1000 + this.attemptedConnectTimes * 10 * 1000); // 30秒后重连 + 每次增加10秒
}
}
}

View File

@@ -8,15 +8,17 @@ export class UploadManager {
}
mvFile(opts: {
temppath: string;
type: 'file' | 's3';
type: 'file' | 's3' | 'app-file';
targetPath: string;
}) {
const { type, temppath, targetPath } = opts;
if (type === 'file') {
const pageDir = this.config.configPath?.pagesDir!;
const { type = 'file', temppath, targetPath } = opts;
const pageDir = this.config.configPath?.pagesDir!;
const appsDir = this.config.configPath?.appsDir!;
let dir = type === 'app-file' ? appsDir : pageDir;
if (type === 'file' || type === 'app-file') {
const fullTargetPath = targetPath.startsWith('/')
? targetPath
: path.join(pageDir, targetPath);
: path.join(dir, targetPath);
const targetDir = fullTargetPath.substring(0, fullTargetPath.lastIndexOf('/'));
if (!fs.existsSync(targetDir)) {
fs.mkdirSync(targetDir, { recursive: true });