refactor(deploy): execute deployments in background to prevent timeouts

- Updated deployment logic across multiple API routes to run deployments in the background, allowing for immediate response and avoiding potential webhook timeouts.
- Added error handling to log any failures during background deployment.
This commit is contained in:
Mauricio Siu
2025-12-13 01:28:19 -06:00
parent 5f13679a97
commit d187b52e09
5 changed files with 54 additions and 30 deletions

View File

@@ -128,7 +128,9 @@ export default async function handler(
if (IS_CLOUD && app.serverId) {
jobData.serverId = app.serverId;
await deploy(jobData);
deploy(jobData).catch((error) => {
console.error("Background deployment failed:", error);
});
continue;
}
await myQueue.add(
@@ -165,7 +167,9 @@ export default async function handler(
if (IS_CLOUD && composeApp.serverId) {
jobData.serverId = composeApp.serverId;
await deploy(jobData);
deploy(jobData).catch((error) => {
console.error("Background deployment failed:", error);
});
continue;
}
@@ -246,7 +250,9 @@ export default async function handler(
if (IS_CLOUD && app.serverId) {
jobData.serverId = app.serverId;
await deploy(jobData);
deploy(jobData).catch((error) => {
console.error("Background deployment failed:", error);
});
continue;
}
await myQueue.add(
@@ -291,7 +297,9 @@ export default async function handler(
}
if (IS_CLOUD && composeApp.serverId) {
jobData.serverId = composeApp.serverId;
await deploy(jobData);
deploy(jobData).catch((error) => {
console.error("Background deployment failed:", error);
});
continue;
}
@@ -491,7 +499,9 @@ export default async function handler(
if (IS_CLOUD && app.serverId) {
jobData.serverId = app.serverId;
await deploy(jobData);
deploy(jobData).catch((error) => {
console.error("Background deployment failed:", error);
});
continue;
}
await myQueue.add(