Skip to content

Commit 969f50d

Browse files
authored
fix(server): restart app when hpa canceled & fix conf publish (#1517)
1 parent 22ef31b commit 969f50d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

server/src/application/application.controller.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -349,13 +349,18 @@ export class ApplicationController {
349349
const isCpuChanged = origin.resource.limitCPU !== doc.resource.limitCPU
350350
const isMemoryChanged =
351351
origin.resource.limitMemory !== doc.resource.limitMemory
352+
const isAutoscalingCanceled =
353+
!doc.autoscaling.enable && origin.autoscaling.enable
352354

353355
if (!isEqual(doc.autoscaling, origin.autoscaling)) {
354356
const { hpa, app } = await this.instance.get(appid)
355357
await this.instance.reapplyHorizontalPodAutoscaler(app, hpa)
356358
}
357359

358-
if (isRunning && (isCpuChanged || isMemoryChanged)) {
360+
if (
361+
isRunning &&
362+
(isCpuChanged || isMemoryChanged || isAutoscalingCanceled)
363+
) {
359364
await this.application.updateState(appid, ApplicationState.Restarting)
360365
}
361366

server/src/application/configuration.service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export class ApplicationConfigurationService {
2929
try {
3030
await session.withTransaction(async () => {
3131
const coll = db.collection(CN_PUBLISHED_CONF)
32-
await coll.deleteOne({ appid: conf.appid }, { session })
32+
await coll.deleteMany({}, { session })
3333
await coll.insertOne(conf, { session })
3434
})
3535
} finally {

0 commit comments

Comments
 (0)