fix: pr feedbacks
This commit is contained in:
parent
d769e08c7b
commit
e48f1f209a
1 changed files with 9 additions and 5 deletions
|
|
@ -166,7 +166,11 @@ export function createAgentManagerRuntime() {
|
|||
return;
|
||||
}
|
||||
|
||||
Effect.runSync(session.handleMessage(data));
|
||||
void Effect.runPromise(session.handleMessage(data)).catch((error) => {
|
||||
logger.error(
|
||||
`Failed to handle message from agent ${ws.data.agentId} on ${ws.data.id}: ${toMessage(error)}`,
|
||||
);
|
||||
});
|
||||
},
|
||||
close: (ws) => {
|
||||
removeSession(ws.data.agentId, ws.data.id);
|
||||
|
|
@ -222,7 +226,7 @@ export function createAgentManagerRuntime() {
|
|||
|
||||
return {
|
||||
start,
|
||||
sendBackup: (agentId: string, payload: BackupRunPayload) => {
|
||||
sendBackup: async (agentId: string, payload: BackupRunPayload) => {
|
||||
const session = getSession(agentId);
|
||||
|
||||
if (!session) {
|
||||
|
|
@ -235,7 +239,7 @@ export function createAgentManagerRuntime() {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!Effect.runSync(session.sendBackup(payload))) {
|
||||
if (!(await Effect.runPromise(session.sendBackup(payload)))) {
|
||||
logger.warn(`Cannot send backup command. Agent ${agentId} is no longer accepting commands.`);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -243,7 +247,7 @@ export function createAgentManagerRuntime() {
|
|||
logger.info(`Sent backup command ${payload.jobId} to agent ${agentId} for schedule ${payload.scheduleId}`);
|
||||
return true;
|
||||
},
|
||||
cancelBackup: (agentId: string, payload: BackupCancelPayload) => {
|
||||
cancelBackup: async (agentId: string, payload: BackupCancelPayload) => {
|
||||
const session = getSession(agentId);
|
||||
|
||||
if (!session) {
|
||||
|
|
@ -251,7 +255,7 @@ export function createAgentManagerRuntime() {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!Effect.runSync(session.sendBackupCancel(payload))) {
|
||||
if (!(await Effect.runPromise(session.sendBackupCancel(payload)))) {
|
||||
logger.warn(`Cannot cancel backup command. Agent ${agentId} is no longer accepting commands.`);
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue