fix: typing

This commit is contained in:
фырат ёздэн
2025-12-14 08:20:00 +03:00
committed by GitHub
parent 669de0f95f
commit b66156956a

View File

@@ -284,33 +284,34 @@ export const cleanupAll = async (serverId?: string) => {
}; };
export const cleanupAllBackground = async (serverId?: string) => { export const cleanupAllBackground = async (serverId?: string) => {
Promise.allSettled( Promise.allSettled(
Object.entries(cleanupCommands) (Object.entries(cleanupCommands) as [
.filter(([key]) => !excludedCleanupAllCommands.includes(key)) keyof typeof cleanupCommands,
.map(async ([, command]) => { string
try { ][])
if (serverId) { .filter(([key]) => !excludedCleanupAllCommands.includes(key))
await execAsyncRemote(serverId, dockerSafeExec(command)); .map(async ([, command]) => {
} else { if (serverId) {
await execAsync(dockerSafeExec(command)); await execAsyncRemote(serverId, dockerSafeExec(command));
} } else {
} catch {} await execAsync(dockerSafeExec(command));
}), }
) })
.then((results) => { )
const failed = results.filter((r) => r.status === "rejected"); .then((results) => {
if (failed.length > 0) { const failed = results.filter((r) => r.status === "rejected");
console.error(`Docker cleanup: ${failed.length} operations failed`); if (failed.length > 0) {
} else { console.error(`Docker cleanup: ${failed.length} operations failed`);
console.log("Docker cleanup completed successfully"); } else {
} console.log("Docker cleanup completed successfully");
}) }
.catch((error) => console.error("Error in cleanup:", error)); })
.catch((error) => console.error("Error in cleanup:", error));
return { return {
status: "scheduled", status: "scheduled",
message: "Docker cleanup has been initiated in the background", message: "Docker cleanup has been initiated in the background",
}; };
}; };
export const startService = async (appName: string) => { export const startService = async (appName: string) => {