You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@yunikorn.apache.org by "Ting Yao,Huang (Jira)" <ji...@apache.org> on 2021/08/20 09:48:00 UTC
[jira] [Resolved] (YUNIKORN-806) Refactor busy loop of
PlaceholderManager#start
[ https://issues.apache.org/jira/browse/YUNIKORN-806?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ting Yao,Huang resolved YUNIKORN-806.
-------------------------------------
Fix Version/s: 1.0.0
Target Version: 1.0.0
Resolution: Fixed
> Refactor busy loop of PlaceholderManager#start
> ----------------------------------------------
>
> Key: YUNIKORN-806
> URL: https://issues.apache.org/jira/browse/YUNIKORN-806
> Project: Apache YuniKorn
> Issue Type: Improvement
> Reporter: Chia-Ping Tsai
> Assignee: Chia-Ping Tsai
> Priority: Trivial
> Labels: pull-request-available
> Fix For: 1.0.0
>
>
> 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