XMLWordPrintableJSON

Details

    Description

      QueueTracker has two methods which both have an unnecessary return value:
       

      increaseTrackedResource() bool
      decreaseTrackedResource() (bool, bool)
      

      The value from increaseTrackedResource() is always true. It used to be different, but it no longer has any relevance.

      Same goes for decreaseTrackedResource(), only the first boolean can change which indicates whether a tracker can be removed.

      Also, UserTracker.increaseTrackedResource() can be simplified as the increment always succeeds and does not need to return anything:

      func (ut *UserTracker) increaseTrackedResource(queuePath string, applicationID string, usage *resources.Resource) bool {
      	ut.Lock()
      	defer ut.Unlock()
      	hierarchy := strings.Split(queuePath, configs.DOT)
      	ut.events.sendIncResourceUsageForUser(ut.userName, queuePath, usage)
      	increased := ut.queueTracker.increaseTrackedResource(hierarchy, applicationID, user, usage)
      	if increased {
      		... // branch always taken
      	}
      	return increased
      }
      

      Attachments

        Issue Links

          Activity

            People

              pbacsko Peter Bacsko
              pbacsko Peter Bacsko
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: