mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 03:11:40 +00:00
refine code
This commit is contained in:
parent
c0bb425d8f
commit
2d98d2412a
@ -64,11 +64,9 @@ func (cfgCtlr *configController) dumpPriorityLevels(w http.ResponseWriter, r *ht
|
|||||||
}
|
}
|
||||||
tabPrint(tabWriter, rowForHeaders(columnHeaders))
|
tabPrint(tabWriter, rowForHeaders(columnHeaders))
|
||||||
endLine(tabWriter)
|
endLine(tabWriter)
|
||||||
plNames := make([]string, len(cfgCtlr.priorityLevelStates))
|
plNames := make([]string, 0, len(cfgCtlr.priorityLevelStates))
|
||||||
i := 0
|
|
||||||
for plName := range cfgCtlr.priorityLevelStates {
|
for plName := range cfgCtlr.priorityLevelStates {
|
||||||
plNames[i] = plName
|
plNames = append(plNames, plName)
|
||||||
i++
|
|
||||||
}
|
}
|
||||||
sort.Strings(plNames)
|
sort.Strings(plNames)
|
||||||
for i := range plNames {
|
for i := range plNames {
|
||||||
|
@ -181,7 +181,7 @@ func (cfgCtlr *configController) Handle(ctx context.Context, requestDigest Reque
|
|||||||
metrics.ObserveWaitingDuration(ctx, pl.Name, fs.Name, strconv.FormatBool(req != nil), time.Since(startWaitingTime))
|
metrics.ObserveWaitingDuration(ctx, pl.Name, fs.Name, strconv.FormatBool(req != nil), time.Since(startWaitingTime))
|
||||||
}
|
}
|
||||||
metrics.AddDispatch(ctx, pl.Name, fs.Name)
|
metrics.AddDispatch(ctx, pl.Name, fs.Name)
|
||||||
fqs.OnRequestDispatched(ctx, req)
|
fqs.OnRequestDispatched(req)
|
||||||
executed = true
|
executed = true
|
||||||
startExecutionTime := time.Now()
|
startExecutionTime := time.Now()
|
||||||
defer func() {
|
defer func() {
|
||||||
|
@ -1071,7 +1071,7 @@ func (qs *queueSet) Dump(includeRequestDetails bool) debug.QueueSetDump {
|
|||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
|
|
||||||
func OnRequestDispatched(ctx context.Context, r fq.Request) {
|
func OnRequestDispatched(r fq.Request) {
|
||||||
req, ok := r.(*request)
|
req, ok := r.(*request)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
@ -1079,7 +1079,7 @@ func OnRequestDispatched(ctx context.Context, r fq.Request) {
|
|||||||
|
|
||||||
qs := req.qs
|
qs := req.qs
|
||||||
if qs != nil {
|
if qs != nil {
|
||||||
qs.lockAndSyncTime(ctx)
|
qs.lock.Lock()
|
||||||
defer qs.lock.Unlock()
|
defer qs.lock.Unlock()
|
||||||
qs.totRequestsDispatched++
|
qs.totRequestsDispatched++
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user