You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@yunikorn.apache.org by "Chia-Ping Tsai (Jira)" <ji...@apache.org> on 2021/08/19 07:06:00 UTC

[jira] [Created] (YUNIKORN-806) Remove busy loop from PlaceholderManager#start

Chia-Ping Tsai created YUNIKORN-806:
---------------------------------------

             Summary: Remove busy loop from PlaceholderManager#start
                 Key: YUNIKORN-806
                 URL: https://issues.apache.org/jira/browse/YUNIKORN-806
             Project: Apache YuniKorn
          Issue Type: Improvement
            Reporter: Chia-Ping Tsai


The busy loop can be refactor by select timeout.
{code:go}
		// 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)
				}
			}
		}
{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: dev-help@yunikorn.apache.org