From db98a5108e714bd168447f2a8c78666c0a67ef07 Mon Sep 17 00:00:00 2001 From: Gareth Date: Fri, 8 Aug 2025 00:43:54 -0700 Subject: [PATCH] add a 60 second timeout for initial mounting --- internal/orchestrator/repo/repo.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/orchestrator/repo/repo.go b/internal/orchestrator/repo/repo.go index ff267078..210cbd5b 100644 --- a/internal/orchestrator/repo/repo.go +++ b/internal/orchestrator/repo/repo.go @@ -114,14 +114,21 @@ func (r *RepoOrchestrator) Mount(ctx context.Context) (string, func(), error) { return "", func() {}, r.mountErr } + // Give mount 60 seconds to succeed, but if it succeeds allow it to run indefinitely in the background. mountCtx, cancel := context.WithCancel(context.Background()) + cancelMounting := time.AfterFunc(60*time.Second, func() { + cancel() + }) + if err := r.repo.Mount(mountCtx, r.mountDir); err != nil { r.logger(ctx).Warn("failed to mount repo", zap.Error(err)) r.mountErr = fmt.Errorf("mount repo %v: %w", r.repoConfig.Id, err) cancel() + cancelMounting.Stop() os.Remove(r.mountDir) return "", func() {}, r.mountErr } + cancelMounting.Stop() r.mountTimer = time.AfterFunc(1000*time.Hour, func() { r.mountMu.Lock() defer r.mountMu.Unlock()