pbacsko commented on code in PR #567:
URL: https://github.com/apache/yunikorn-core/pull/567#discussion_r1229389423


##########
pkg/scheduler/objects/queue.go:
##########
@@ -1050,14 +1069,22 @@ func (sq *Queue) sortApplications(filterApps bool) 
[]*Application {
        return sortApplications(sq.GetCopyOfApps(), queueSortType, 
sq.IsPrioritySortEnabled(), sq.GetGuaranteedResource())
 }
 
-// sortQueues returns a sorted shallow copy of the queues for this parent 
queue.
+// getSortedQueues returns a sorted shallow copy of the queues for this parent 
queue.
 // Only queues with a pending resource request are considered. The queues are 
sorted using the
 // sorting type for the parent queue.
 // Lock free call all locks are taken when needed in called functions
-func (sq *Queue) sortQueues() []*Queue {
+func (sq *Queue) getSortedQueues() []*Queue {
        if sq.IsLeafQueue() {
                return nil
        }
+
+       sq.RLock()

Review Comment:
   Extract this to a separate internal method, that `defer` right before the 
return doesn't make any sense.
   Like:
   
   ```
   func (sq *Queue) getCachedSortedQueues() []*Queue {
     sq.RLock()
     defer sq.RUnlock()
     
     return sq.sortedQueues
   }
   ```



-- 
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]

Reply via email to