diff --git a/server/src/application/application-task.service.ts b/server/src/application/application-task.service.ts index e3f5b3e..253320a 100644 --- a/server/src/application/application-task.service.ts +++ b/server/src/application/application-task.service.ts @@ -89,25 +89,6 @@ export class ApplicationTaskService { const app = res.value const appid = app.appid - // if waiting time is more than 5 minutes, delete the application - const waitingTime = Date.now() - app.updatedAt.getTime() - if (waitingTime > 1000 * 60 * 5) { - await db.collection('Application').updateOne( - { appid, phase: ApplicationPhase.Creating }, - { - $set: { - state: ApplicationState.Deleted, - phase: ApplicationPhase.Deleting, - lockedAt: TASK_LOCK_INIT_TIME, - updatedAt: new Date(), - }, - }, - ) - - this.logger.log(`${app.appid} updated to state Deleted due to timeout`) - return - } - this.logger.log(`handleCreatingPhase matched app ${appid}, locked it`) // get region by appid @@ -123,6 +104,7 @@ export class ApplicationTaskService { // waiting resources' phase to be `Created` if (runtimeDomain?.phase !== DomainPhase.Created) { + await this.unlock(appid) return } diff --git a/server/src/database/dedicated-database/dedicated-database-task.service.ts b/server/src/database/dedicated-database/dedicated-database-task.service.ts index 75adad4..fbe42d7 100644 --- a/server/src/database/dedicated-database/dedicated-database-task.service.ts +++ b/server/src/database/dedicated-database/dedicated-database-task.service.ts @@ -72,9 +72,9 @@ export class DedicatedDatabaseTaskService { await this.dbService.applyDeployManifest(region, user, appid) } - // if waiting time is more than 5 minutes, stop + // if waiting time is more than 10 minutes, stop const waitingTime = Date.now() - data.updatedAt.getTime() - if (waitingTime > 1000 * 60 * 5) { + if (waitingTime > 1000 * 60 * 10) { await this.db .collection('DedicatedDatabase') .updateOne( diff --git a/server/src/instance/instance-task.service.ts b/server/src/instance/instance-task.service.ts index 0fa67de..6134a11 100644 --- a/server/src/instance/instance-task.service.ts +++ b/server/src/instance/instance-task.service.ts @@ -109,9 +109,9 @@ export class InstanceTaskService { if (!res.value) return const app = res.value - // if waiting time is more than 5 minutes, stop the application + // if waiting time is more than 10 minutes, stop the application const waitingTime = Date.now() - app.updatedAt.getTime() - if (waitingTime > 1000 * 60 * 5) { + if (waitingTime > 1000 * 60 * 10) { await db.collection('Application').updateOne( { appid: app.appid, phase: ApplicationPhase.Starting }, {