From 9b98fc06489353053564b431ac0c0d73a5c55a56 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Wed, 21 Dec 2022 21:54:36 +0100 Subject: cache: tie up the refactor up to compiling --- commands/webui.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'commands/webui.go') diff --git a/commands/webui.go b/commands/webui.go index 5fe66aa7..e1e0fc2b 100644 --- a/commands/webui.go +++ b/commands/webui.go @@ -105,7 +105,7 @@ func runWebUI(env *execenv.Env, opts webUIOptions) error { } mrc := cache.NewMultiRepoCache() - _, err := mrc.RegisterDefaultRepository(env.Repo) + _, _, err := mrc.RegisterDefaultRepository(env.Repo) if err != nil { return err } -- cgit From d65e8837aa7bb1a6abb6892b9f2664e1b7edb02e Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Thu, 22 Dec 2022 00:48:00 +0100 Subject: cache: generic withSnapshot, some cleanup --- commands/webui.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'commands/webui.go') diff --git a/commands/webui.go b/commands/webui.go index e1e0fc2b..4f7a02b5 100644 --- a/commands/webui.go +++ b/commands/webui.go @@ -105,11 +105,25 @@ func runWebUI(env *execenv.Env, opts webUIOptions) error { } mrc := cache.NewMultiRepoCache() - _, _, err := mrc.RegisterDefaultRepository(env.Repo) + _, events, err := mrc.RegisterDefaultRepository(env.Repo) if err != nil { return err } + for event := range events { + if event.Err != nil { + env.Err.Printf("Cache building error [%s]: %v\n", event.Typename, event.Err) + continue + } + + switch event.Event { + case cache.BuildEventStarted: + env.Err.Printf("[%s] started\n", event.Typename) + case cache.BuildEventFinished: + env.Err.Printf("[%s] done\n", event.Typename) + } + } + var errOut io.Writer if opts.logErrors { errOut = env.Err -- cgit From 95911100823b5c809225d664de74ad2d64e91972 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Thu, 22 Dec 2022 23:19:31 +0100 Subject: cache: fix some bugs after refactor --- commands/webui.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'commands/webui.go') diff --git a/commands/webui.go b/commands/webui.go index 4f7a02b5..6cbaff78 100644 --- a/commands/webui.go +++ b/commands/webui.go @@ -110,17 +110,19 @@ func runWebUI(env *execenv.Env, opts webUIOptions) error { return err } - for event := range events { - if event.Err != nil { - env.Err.Printf("Cache building error [%s]: %v\n", event.Typename, event.Err) - continue - } - - switch event.Event { - case cache.BuildEventStarted: - env.Err.Printf("[%s] started\n", event.Typename) - case cache.BuildEventFinished: - env.Err.Printf("[%s] done\n", event.Typename) + if events != nil { + env.Err.Println("Building cache... ") + for event := range events { + if event.Err != nil { + env.Err.Printf("Cache building error [%s]: %v\n", event.Typename, event.Err) + continue + } + switch event.Event { + case cache.BuildEventStarted: + env.Err.Printf("[%s] started\n", event.Typename) + case cache.BuildEventFinished: + env.Err.Printf("[%s] done\n", event.Typename) + } } } -- cgit