fix: 调整重连逻辑以增加每次连接尝试的延迟时间;更新 mvFile 方法以支持 'app-file' 类型
This commit is contained in:
@@ -122,7 +122,7 @@ export class AssistantApp extends Manager {
|
|||||||
} else {
|
} else {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.reconnectRemoteApp();
|
this.reconnectRemoteApp();
|
||||||
}, 30 * 1000); // 30秒后重连
|
}, 30 * 1000 + this.attemptedConnectTimes * 10 * 1000); // 30秒后重连 + 每次增加10秒
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,15 +8,17 @@ export class UploadManager {
|
|||||||
}
|
}
|
||||||
mvFile(opts: {
|
mvFile(opts: {
|
||||||
temppath: string;
|
temppath: string;
|
||||||
type: 'file' | 's3';
|
type: 'file' | 's3' | 'app-file';
|
||||||
targetPath: string;
|
targetPath: string;
|
||||||
}) {
|
}) {
|
||||||
const { type, temppath, targetPath } = opts;
|
const { type = 'file', temppath, targetPath } = opts;
|
||||||
if (type === 'file') {
|
const pageDir = this.config.configPath?.pagesDir!;
|
||||||
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('/')
|
const fullTargetPath = targetPath.startsWith('/')
|
||||||
? targetPath
|
? targetPath
|
||||||
: path.join(pageDir, targetPath);
|
: path.join(dir, targetPath);
|
||||||
const targetDir = fullTargetPath.substring(0, fullTargetPath.lastIndexOf('/'));
|
const targetDir = fullTargetPath.substring(0, fullTargetPath.lastIndexOf('/'));
|
||||||
if (!fs.existsSync(targetDir)) {
|
if (!fs.existsSync(targetDir)) {
|
||||||
fs.mkdirSync(targetDir, { recursive: true });
|
fs.mkdirSync(targetDir, { recursive: true });
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import { runCode } from '../../module/light-code/run.ts'
|
|||||||
|
|
||||||
// http://localhost:4005/api/router?path=call
|
// http://localhost:4005/api/router?path=call
|
||||||
app.route({
|
app.route({
|
||||||
path: 'call',
|
path: 'light-code',
|
||||||
|
key: 'call',
|
||||||
// middleware: ['auth']
|
// middleware: ['auth']
|
||||||
}).define(async (ctx) => {
|
}).define(async (ctx) => {
|
||||||
const filename = ctx.query?.filename || 'root/light-code-demo/demo-router.ts'
|
const filename = ctx.query?.filename || 'root/light-code-demo/demo-router.ts'
|
||||||
|
|||||||
Reference in New Issue
Block a user