Skip to content

Commit

Permalink
fix(server): fix waiting time in instance starting task (#1075)
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow authored Apr 24, 2023
1 parent f0f1582 commit fa72bb9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions server/src/instance/instance-task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class InstanceTaskService {

// if waiting time is more than 5 minutes, stop the application
const waitingTime = Date.now() - app.updatedAt.getTime()
if (waitingTime > 1000 * 60 * 3) {
if (waitingTime > 1000 * 60 * 5) {
await db.collection<Application>('Application').updateOne(
{ appid: app.appid, phase: ApplicationPhase.Starting },
{
Expand All @@ -133,12 +133,12 @@ export class InstanceTaskService {
instance.deployment?.status?.conditions || [],
)
if (!available) {
await this.relock(appid)
await this.relock(appid, waitingTime)
return
}

if (!instance.service) {
await this.relock(appid)
await this.relock(appid, waitingTime)
return
}

Expand Down Expand Up @@ -297,9 +297,9 @@ export class InstanceTaskService {
* Relock application by appid, lockedTime is in milliseconds
*/
async relock(appid: string, lockedTime = 0) {
// if lockedTime greater than 5 minutes, set it to 10 minutes
if (lockedTime > 5 * 60 * 1000) {
lockedTime = 5 * 60 * 1000
// if lockedTime greater than 3 minutes, set it to 3 minutes
if (lockedTime > 3 * 60 * 1000) {
lockedTime = 3 * 60 * 1000
}

const db = SystemDatabase.db
Expand Down

0 comments on commit fa72bb9

Please sign in to comment.