feat(scheduler): gracefully shutdown (#1951)

wait for workers to finish before exiting

should fix tests reporting they couldn't remove rootDir because it's being
written by tasks

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
peusebiu
2023-11-24 10:40:10 +02:00
committed by GitHub
parent 92837c2bcb
commit 6222dae1f0
49 changed files with 710 additions and 379 deletions
+10
View File
@@ -1,6 +1,7 @@
package common
import (
"context"
"encoding/json"
"errors"
"fmt"
@@ -135,3 +136,12 @@ func IsReferrersTag(tag string) bool {
return referrersTagRule.MatchString(tag)
}
func IsContextDone(ctx context.Context) bool {
select {
case <-ctx.Done():
return true
default:
return false
}
}