fix: pr feedbacks

This commit is contained in:
Nicolas Meienberger 2026-04-09 19:43:13 +02:00
parent d769e08c7b
commit e48f1f209a
No known key found for this signature in database

View file

@ -166,7 +166,11 @@ export function createAgentManagerRuntime() {
return; 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) => { close: (ws) => {
removeSession(ws.data.agentId, ws.data.id); removeSession(ws.data.agentId, ws.data.id);
@ -222,7 +226,7 @@ export function createAgentManagerRuntime() {
return { return {
start, start,
sendBackup: (agentId: string, payload: BackupRunPayload) => { sendBackup: async (agentId: string, payload: BackupRunPayload) => {
const session = getSession(agentId); const session = getSession(agentId);
if (!session) { if (!session) {
@ -235,7 +239,7 @@ export function createAgentManagerRuntime() {
return false; 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.`); logger.warn(`Cannot send backup command. Agent ${agentId} is no longer accepting commands.`);
return false; return false;
} }
@ -243,7 +247,7 @@ export function createAgentManagerRuntime() {
logger.info(`Sent backup command ${payload.jobId} to agent ${agentId} for schedule ${payload.scheduleId}`); logger.info(`Sent backup command ${payload.jobId} to agent ${agentId} for schedule ${payload.scheduleId}`);
return true; return true;
}, },
cancelBackup: (agentId: string, payload: BackupCancelPayload) => { cancelBackup: async (agentId: string, payload: BackupCancelPayload) => {
const session = getSession(agentId); const session = getSession(agentId);
if (!session) { if (!session) {
@ -251,7 +255,7 @@ export function createAgentManagerRuntime() {
return false; 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.`); logger.warn(`Cannot cancel backup command. Agent ${agentId} is no longer accepting commands.`);
return false; return false;
} }