Uploaded image for project: 'Apache YuniKorn'
  1. Apache YuniKorn
  2. YUNIKORN-806

Refactor busy loop of PlaceholderManager#start

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • None
    • 0.12.1
    • None

    Description

      The busy loop can be refactor by select timeout.

      		// clean orphan placeholders approximately every 5 seconds, check for stop every 100 milliseconds
      		for {
      			mgr.cleanOrphanPlaceholders()
      			for i := 0; i < 50; i++ {
      				select {
      				case <-mgr.stopChan:
      					mgr.setRunning(false)
      					log.Logger().Info("PlaceholderManager has been stopped")
      					return
      				default:
      					time.Sleep(100 * time.Millisecond)
      				}
      			}
      		}
      

      Attachments

        Issue Links

          Activity

            No work has yet been logged on this issue.

            People

              chia7712 Chia-Ping Tsai
              chia7712 Chia-Ping Tsai
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: