code format

This commit is contained in:
6543 2022-11-12 00:15:06 +01:00
parent cba996978e
commit ae610d301a
No known key found for this signature in database
GPG key ID: B8BE6D610E61C862

View file

@ -60,7 +60,7 @@ func (f FileResponse) createHttpResponse(cacheKey string) (http.Header, int) {
header.Set(ContentLengthHeader, fmt.Sprintf("%d", len(f.Body)))
header.Set(PagesCacheIndicatorHeader, "true")
log.Trace().Msgf("fileCache for '%s' used", cacheKey)
log.Trace().Msgf("fileCache for %q used", cacheKey)
return header, statusCode
}
@ -95,19 +95,19 @@ 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)
log.Trace().Msgf("cacheReader for %q saved=%t closed", t.cacheKey, !t.hasErr)
return t.rc.Close()
}
func (f FileResponse) CreateCacheReader(r io.ReadCloser, cache cache.SetGetKey, cacheKey string) io.ReadCloser {
buf := []byte{}
if r == nil || cache == nil || cacheKey == "" {
log.Error().Msg("could not create CacheReader")
return r
return nil
}
return &writeCacheReader{
rc: r,
buff: bytes.NewBuffer(buf),
buff: bytes.NewBuffer(make([]byte, 0)),
f: &f,
cache: cache,
cacheKey: cacheKey,