Skip to content

Commit 7e69399

Browse files
committed
use qos block to configure QOS
1 parent bde2fd1 commit 7e69399

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

custom/conf/app.example.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,7 @@ LEVEL = Info
949949

950950
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
951951
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
952-
;[service.qos]
952+
;[qos]
953953
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
954954
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
955955
;; Enable request quality of service and load shedding.

modules/setting/service.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,7 @@ func loadServiceFrom(rootCfg ConfigProvider) {
263263
mustMapSetting(rootCfg, "service.explore", &Service.Explore)
264264

265265
loadOpenIDSetting(rootCfg)
266-
267-
qosSection := rootCfg.Section("service.qos")
268-
Service.QoS.Enabled = qosSection.Key("ENABLED").MustBool(false)
269-
Service.QoS.MaxInFlightRequests = qosSection.Key("MAX_INFLIGHT").MustInt(4 * runtime.NumCPU())
270-
Service.QoS.MaxWaitingRequests = qosSection.Key("MAX_WAITING").MustInt(100)
271-
Service.QoS.TargetWaitTime = qosSection.Key("TARGET_WAIT_TIME").MustDuration(50 * time.Millisecond)
266+
loadQosSetting(rootCfg)
272267
}
273268

274269
func loadOpenIDSetting(rootCfg ConfigProvider) {
@@ -290,3 +285,11 @@ func loadOpenIDSetting(rootCfg ConfigProvider) {
290285
}
291286
}
292287
}
288+
289+
func loadQosSetting(rootCfg ConfigProvider) {
290+
sec := rootCfg.Section("qos")
291+
Service.QoS.Enabled = sec.Key("ENABLED").MustBool(false)
292+
Service.QoS.MaxInFlightRequests = sec.Key("MAX_INFLIGHT").MustInt(4 * runtime.NumCPU())
293+
Service.QoS.MaxWaitingRequests = sec.Key("MAX_WAITING").MustInt(100)
294+
Service.QoS.TargetWaitTime = sec.Key("TARGET_WAIT_TIME").MustDuration(50 * time.Millisecond)
295+
}

0 commit comments

Comments
 (0)