From c6326c88afea0b64323eb90716de27ac69c19205 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sat, 12 Nov 2022 00:49:47 +0100 Subject: [PATCH] cache write error does not care what content is stored --- server/gitea/client.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/server/gitea/client.go b/server/gitea/client.go index 47280f0..3d7fd44 100644 --- a/server/gitea/client.go +++ b/server/gitea/client.go @@ -143,7 +143,7 @@ func (client *Client) ServeRawContent(targetOwner, targetRepo, ref, resource str Body: []byte(linkDest), ETag: resp.Header.Get(ETagHeader), }, fileCacheTimeout); err != nil { - log.Error().Err(err).Msg("could not save symlink in cache") + log.Error().Err(err).Msg("[cache] error on cache write") } log.Debug().Msgf("follow symlink from %q to %q", resource, linkDest) @@ -172,7 +172,7 @@ func (client *Client) ServeRawContent(targetOwner, targetRepo, ref, resource str Exists: false, ETag: resp.Header.Get(ETagHeader), }, fileCacheTimeout); err != nil { - log.Error().Err(err).Msg("could not save 404 in cache") + log.Error().Err(err).Msg("[cache] error on cache write") } return nil, resp.Response.Header, http.StatusNotFound, ErrorNotFound @@ -189,19 +189,19 @@ func (client *Client) GiteaGetRepoBranchTimestamp(repoOwner, repoName, branchNam if stamp, ok := client.responseCache.Get(cacheKey); ok && stamp != nil { branchTimeStamp := stamp.(*BranchTimestamp) if branchTimeStamp.notFound { - log.Trace().Msgf("use cache branch [%s] not found", branchName) + log.Trace().Msgf("[cache] use branch %q not found", branchName) return &BranchTimestamp{}, ErrorNotFound } - log.Trace().Msgf("use cache branch [%s] exist", branchName) + log.Trace().Msgf("[cache] use branch %q exist", branchName) return branchTimeStamp, nil } branch, resp, err := client.sdkClient.GetRepoBranch(repoOwner, repoName, branchName) if err != nil { if resp != nil && resp.StatusCode == http.StatusNotFound { - log.Trace().Msgf("set cache branch [%s] not found", branchName) + log.Trace().Msgf("[cache] set cache branch %q not found", branchName) if err := client.responseCache.Set(cacheKey, &BranchTimestamp{Branch: branchName, notFound: true}, branchExistenceCacheTimeout); err != nil { - log.Error().Err(err).Msgf("error on store of repo branch timestamp [%s/%s@%s]", repoOwner, repoName, branchName) + log.Error().Err(err).Msg("[cache] error on cache write") } return &BranchTimestamp{}, ErrorNotFound } @@ -218,7 +218,7 @@ func (client *Client) GiteaGetRepoBranchTimestamp(repoOwner, repoName, branchNam log.Trace().Msgf("set cache branch [%s] exist", branchName) if err := client.responseCache.Set(cacheKey, stamp, branchExistenceCacheTimeout); err != nil { - log.Error().Err(err).Msgf("error on store of repo branch timestamp [%s/%s@%s]", repoOwner, repoName, branchName) + log.Error().Err(err).Msg("[cache] error on cache write") } return stamp, nil } @@ -240,7 +240,7 @@ func (client *Client) GiteaGetRepoDefaultBranch(repoOwner, repoName string) (str branch := repo.DefaultBranch if err := client.responseCache.Set(cacheKey, branch, defaultBranchCacheTimeout); err != nil { - log.Error().Err(err).Msgf("error on store of repo default branch [%s/%s]", repoOwner, repoName) + log.Error().Err(err).Msg("[cache] error on cache write") } return branch, nil }