Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): fix waiting time in instance starting task #1075

Merged
merged 1 commit into from
Apr 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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