mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
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:
@@ -292,10 +292,8 @@ func (service *BaseService) SyncRepo(ctx context.Context, repo string) error {
|
||||
localRepo := service.contentManager.GetRepoDestination(repo)
|
||||
|
||||
for _, tag := range tags {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
if common.IsContextDone(ctx) {
|
||||
return ctx.Err()
|
||||
default:
|
||||
}
|
||||
|
||||
if references.IsCosignTag(tag) || common.IsReferrersTag(tag) {
|
||||
|
||||
@@ -1883,9 +1883,6 @@ func TestConfigReloader(t *testing.T) {
|
||||
destConfig.Log.Output = logFile.Name()
|
||||
|
||||
dctlr := api.NewController(destConfig)
|
||||
dcm := test.NewControllerManager(dctlr)
|
||||
|
||||
defer dcm.StopServer()
|
||||
|
||||
//nolint: dupl
|
||||
Convey("Reload config without sync", func() {
|
||||
@@ -1927,6 +1924,8 @@ func TestConfigReloader(t *testing.T) {
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
|
||||
defer dctlr.Shutdown()
|
||||
|
||||
// let it sync
|
||||
time.Sleep(3 * time.Second)
|
||||
|
||||
@@ -2075,6 +2074,8 @@ func TestConfigReloader(t *testing.T) {
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
|
||||
defer dctlr.Shutdown()
|
||||
|
||||
// let it sync
|
||||
time.Sleep(3 * time.Second)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user