mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2024-11-05 14:07:01 +00:00
more logging
This commit is contained in:
parent
026ef06afe
commit
63d0b8d320
2 changed files with 4 additions and 2 deletions
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue