more logging

This commit is contained in:
6543 2022-11-08 00:15:09 +01:00
parent 026ef06afe
commit 63d0b8d320
No known key found for this signature in database
GPG key ID: B8BE6D610E61C862
2 changed files with 4 additions and 2 deletions

View file

@ -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()
}

View file

@ -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 {