From dd7cc6ed689d01d14588ec09202b5aae5fb5c9a8 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 18 Sep 2023 12:03:10 +0300 Subject: fix(tvix/nar-bridge): don't log error on simple 404s `nix copy` checks if NARs and NARInfo files are present, before uploading them. That's not an error, but normal behaviour, so no need to log with level info for these cases. We only want to log if the error is not a 404, and log with Warn level. Change-Id: I762de3b862d070a0f18bc62e324e94ca5c7c3693 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9359 Reviewed-by: Connor Brewster Tested-by: BuildkiteCI --- tvix/nar-bridge/pkg/server/nar_get.go | 2 +- tvix/nar-bridge/pkg/server/narinfo_get.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tvix/nar-bridge/pkg/server/nar_get.go b/tvix/nar-bridge/pkg/server/nar_get.go index c8c35e69ff..d1a9426f33 100644 --- a/tvix/nar-bridge/pkg/server/nar_get.go +++ b/tvix/nar-bridge/pkg/server/nar_get.go @@ -171,10 +171,10 @@ func registerNarGet(s *Server) { err = renderNar(ctx, log, s.directoryServiceClient, s.blobServiceClient, &s.narHashToPathInfoMu, s.narHashToPathInfo, w, narHash, true) if err != nil { - log.WithError(err).Info("unable to render nar") if errors.Is(err, fs.ErrNotExist) { w.WriteHeader(http.StatusNotFound) } else { + log.WithError(err).Warn("unable to render nar") w.WriteHeader(http.StatusInternalServerError) } } diff --git a/tvix/nar-bridge/pkg/server/narinfo_get.go b/tvix/nar-bridge/pkg/server/narinfo_get.go index 977e113613..ec850670b4 100644 --- a/tvix/nar-bridge/pkg/server/narinfo_get.go +++ b/tvix/nar-bridge/pkg/server/narinfo_get.go @@ -135,10 +135,10 @@ func registerNarinfoGet(s *Server) { err = renderNarinfo(ctx, log, s.pathInfoServiceClient, &s.narHashToPathInfoMu, s.narHashToPathInfo, outputHash, w, false) if err != nil { - log.WithError(err).Info("unable to render narinfo") if errors.Is(err, fs.ErrNotExist) { w.WriteHeader(http.StatusNotFound) } else { + log.WithError(err).Warn("unable to render narinfo") w.WriteHeader(http.StatusInternalServerError) } } -- cgit 1.4.1