feat: 更新保持工作空间存活功能,移除wsUrl参数并在createLiveData中生成
This commit is contained in:
@@ -40,7 +40,7 @@ app.route({
|
|||||||
|
|
||||||
console.log(`启动保持工作空间 ${wsUrl} 存活的任务`);
|
console.log(`启动保持工作空间 ${wsUrl} 存活的任务`);
|
||||||
|
|
||||||
const config: KeepAliveData = createLiveData({ wsUrl, cookie, repo, pipelineId });
|
const config: KeepAliveData = createLiveData({ cookie, repo, pipelineId });
|
||||||
addKeepAliveData(config);
|
addKeepAliveData(config);
|
||||||
|
|
||||||
ctx.body = { content: `已启动保持工作空间 ${wsUrl} 存活的任务`, data: config };
|
ctx.body = { content: `已启动保持工作空间 ${wsUrl} 存活的任务`, data: config };
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@kevisual/cnb",
|
"name": "@kevisual/cnb",
|
||||||
"version": "0.0.30",
|
"version": "0.0.31",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -104,9 +104,10 @@ export function removeKeepAliveData(repo: string, pipelineId: string): KeepAlive
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createLiveData = (data: { wsUrl: string, cookie: string, repo: string, pipelineId: string }): KeepAliveData => {
|
export const createLiveData = (data: { cookie: string, repo: string, pipelineId: string }): KeepAliveData => {
|
||||||
const { wsUrl, cookie, repo, pipelineId } = data;
|
const { cookie, repo, pipelineId } = data;
|
||||||
const createdTime = Date.now();
|
const createdTime = Date.now();
|
||||||
|
const wsUrl = `wss://${pipelineId}.cnb.space:443?skipWebSocketFrames=false`;
|
||||||
const pm2Name = `${repo}__${pipelineId}`.replace(/\//g, '__');
|
const pm2Name = `${repo}__${pipelineId}`.replace(/\//g, '__');
|
||||||
const filePath = path.join(os.homedir(), '.cnb', `${pm2Name}.json`);
|
const filePath = path.join(os.homedir(), '.cnb', `${pm2Name}.json`);
|
||||||
const _newData = { wss: wsUrl, wsUrl, cookie, repo, pipelineId, createdTime, filePath, pm2Name };
|
const _newData = { wss: wsUrl, wsUrl, cookie, repo, pipelineId, createdTime, filePath, pm2Name };
|
||||||
@@ -125,8 +126,8 @@ export class KeepAliveManager {
|
|||||||
static add(data: KeepAliveData) {
|
static add(data: KeepAliveData) {
|
||||||
return addKeepAliveData(data);
|
return addKeepAliveData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static createLiveData(data: { wsUrl: string, cookie: string, repo: string, pipelineId: string }): KeepAliveData {
|
static createLiveData(data: { cookie: string, repo: string, pipelineId: string }): KeepAliveData {
|
||||||
return createLiveData(data);
|
return createLiveData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user