Skip to content

Commit

Permalink
lengthen timeout time
Browse files Browse the repository at this point in the history
  • Loading branch information
0fatal committed Mar 25, 2024
1 parent 6a98650 commit 834fb3b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 23 deletions.
20 changes: 1 addition & 19 deletions server/src/application/application-task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>('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
Expand All @@ -123,6 +104,7 @@ export class ApplicationTaskService {

// waiting resources' phase to be `Created`
if (runtimeDomain?.phase !== DomainPhase.Created) {
await this.unlock(appid)
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>('DedicatedDatabase')
.updateOne(
Expand Down
4 changes: 2 additions & 2 deletions server/src/instance/instance-task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>('Application').updateOne(
{ appid: app.appid, phase: ApplicationPhase.Starting },
{
Expand Down

0 comments on commit 834fb3b

Please sign in to comment.