From 53b3726588eb1d5f35c661900fd747549e7a2842 Mon Sep 17 00:00:00 2001 From: Aditya Hegde Date: Tue, 30 Apr 2024 16:22:55 +0530 Subject: [PATCH 1/2] Fix admin repo startup deadlock --- runtime/drivers/admin/admin.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/runtime/drivers/admin/admin.go b/runtime/drivers/admin/admin.go index c025bda0832..0c3f8e06497 100644 --- a/runtime/drivers/admin/admin.go +++ b/runtime/drivers/admin/admin.go @@ -262,19 +262,19 @@ func (h *Handle) cloneOrPull(ctx context.Context) error { return nil, err } - // Read rill.yaml and fill in `ignore_paths` - rawYaml, err := h.Get(context.Background(), "/rill.yaml") - if err == nil { - yml := &rillYAML{} - err = yaml.Unmarshal([]byte(rawYaml), yml) - if err == nil { - h.ignorePaths = yml.IgnorePaths - } - } - return nil, nil }) + // Read rill.yaml and fill in `ignore_paths` + rawYaml, err := h.Get(context.Background(), "/rill.yaml") + if err == nil { + yml := &rillYAML{} + err = yaml.Unmarshal([]byte(rawYaml), yml) + if err == nil { + h.ignorePaths = yml.IgnorePaths + } + } + select { case <-ctx.Done(): return ctx.Err() From d74daf841e122dc7c96e0d363769cfd4d4f5aef1 Mon Sep 17 00:00:00 2001 From: Aditya Hegde Date: Tue, 30 Apr 2024 16:44:28 +0530 Subject: [PATCH 2/2] Moving inside lock --- runtime/drivers/admin/admin.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/runtime/drivers/admin/admin.go b/runtime/drivers/admin/admin.go index 0c3f8e06497..09d7058b27c 100644 --- a/runtime/drivers/admin/admin.go +++ b/runtime/drivers/admin/admin.go @@ -262,18 +262,18 @@ func (h *Handle) cloneOrPull(ctx context.Context) error { return nil, err } - return nil, nil - }) - - // Read rill.yaml and fill in `ignore_paths` - rawYaml, err := h.Get(context.Background(), "/rill.yaml") - if err == nil { - yml := &rillYAML{} - err = yaml.Unmarshal([]byte(rawYaml), yml) + // Read rill.yaml and fill in `ignore_paths` + rawYaml, err := os.ReadFile(filepath.Join(h.projPath, "/rill.yaml")) if err == nil { - h.ignorePaths = yml.IgnorePaths + yml := &rillYAML{} + err = yaml.Unmarshal(rawYaml, yml) + if err == nil { + h.ignorePaths = yml.IgnorePaths + } } - } + + return nil, nil + }) select { case <-ctx.Done():