craigcondit commented on code in PR #429:
URL: https://github.com/apache/yunikorn-core/pull/429#discussion_r1026679388
##########
pkg/scheduler/objects/queue.go:
##########
@@ -1292,3 +1304,67 @@ func (sq *Queue) String() string {
return fmt.Sprintf("{QueuePath: %s, State: %s, StateTime: %x,
MaxResource: %s}",
sq.QueuePath, sq.stateMachine.Current(), sq.stateTime,
sq.maxResource)
}
+
+func (sq *Queue) incRunningApps() {
+ if sq == nil {
+ return
+ }
+ if sq.parent != nil {
+ sq.parent.incRunningApps()
+ }
+ sq.internalIncRunningApps()
+}
+
+func (sq *Queue) internalIncRunningApps() {
+ sq.Lock()
+ defer sq.Unlock()
+ sq.runningApps++
+}
Review Comment:
Inlining `internalIncRunningApps()` will not change the behavior in any way,
because the unlock will happen prior to returning from `incRunningApps()` in
either case. They are functionally equivalent. However, do be sure that the
lock and defer still come immediately before incrementing `runningApps`. They
should not be relocated to the top of `incRunningApps()`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]