From 63d0b8d320ccd14d3cd462e33e0e22393e0ed954 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Tue, 8 Nov 2022 00:15:09 +0100 Subject: [PATCH] more logging --- server/gitea/cache.go | 4 +++- server/gitea/client.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/server/gitea/cache.go b/server/gitea/cache.go index 0f2a659..0b7f702 100644 --- a/server/gitea/cache.go +++ b/server/gitea/cache.go @@ -42,7 +42,7 @@ func (f FileResponse) IsEmpty() bool { return len(f.Body) != 0 } -func (f FileResponse) createHttpResponse() (http.Header, int) { +func (f FileResponse) createHttpResponse(cacheKey string) (http.Header, int) { header := make(http.Header) var statusCode int @@ -60,6 +60,7 @@ func (f FileResponse) createHttpResponse() (http.Header, int) { header.Set(ContentLengthHeader, fmt.Sprint(len(f.Body))) header.Set(PagesCacheIndicatorHeader, "true") + log.Trace().Msgf("fileCache for '%s' used", cacheKey) return header, statusCode } @@ -93,6 +94,7 @@ func (t *writeCacheReader) Close() error { fc.Body = t.buff.Bytes() _ = t.cache.Set(t.cacheKey, fc, fileCacheTimeout) } + log.Trace().Msgf("cacheReader for '%s' saved=%v closed", t.cacheKey, !t.hasErr) return t.rc.Close() } diff --git a/server/gitea/client.go b/server/gitea/client.go index dff672a..87c936a 100644 --- a/server/gitea/client.go +++ b/server/gitea/client.go @@ -102,7 +102,7 @@ func (client *Client) ServeRawContent(targetOwner, targetRepo, ref, resource str // handle if cache entry exist if cache, ok := client.responseCache.Get(cacheKey); ok { cache := cache.(FileResponse) - cachedHeader, cachedStatusCode := cache.createHttpResponse() + cachedHeader, cachedStatusCode := cache.createHttpResponse(cacheKey) // TODO: check against some timestamp missmatch?!? if cache.Exists { if cache.IsSymlink {