mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-06-10 13:30:49 +00:00
Stabilize existence-cache feature.
Also, make the logging a bit quieter.
This commit is contained in:
+8
-10
@@ -54,14 +54,12 @@ type ExistenceCache interface {
|
||||
}
|
||||
|
||||
func CreateExistenceCache(ctx context.Context) (ExistenceCache, error) {
|
||||
if config.Feature("existence-cache") {
|
||||
switch config.Storage.Type {
|
||||
case "s3":
|
||||
maxAge := time.Duration(config.Storage.S3.SiteCache.MaxAge)
|
||||
return createBloomExistenceCache(ctx, maxAge)
|
||||
default:
|
||||
// not needed
|
||||
}
|
||||
switch config.Storage.Type {
|
||||
case "s3":
|
||||
maxAge := time.Duration(config.Storage.S3.SiteCache.MaxAge)
|
||||
return createBloomExistenceCache(ctx, maxAge)
|
||||
default:
|
||||
// not needed
|
||||
}
|
||||
|
||||
return &dummyExistenceCache{}, nil
|
||||
@@ -156,7 +154,7 @@ func (c *bloomExistenceCache) CheckSite(ctx context.Context, site string) (resul
|
||||
}
|
||||
c.filterMu.Unlock()
|
||||
|
||||
logc.Printf(ctx, "existence: site %s: %s", site, result)
|
||||
logc.Debugf(ctx, "existence: site %s: %s", site, result)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -174,7 +172,7 @@ func (c *bloomExistenceCache) CheckDomain(ctx context.Context, domain string) (r
|
||||
}
|
||||
c.filterMu.Unlock()
|
||||
|
||||
logc.Printf(ctx, "existence: domain %s: %s", domain, result)
|
||||
logc.Debugf(ctx, "existence: domain %s: %s", domain, result)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,14 @@ func (l slogWithCtx) log(ctx context.Context, level slog.Level, msg string) {
|
||||
logger.Handler().Handle(ctx, record)
|
||||
}
|
||||
|
||||
func (l slogWithCtx) Debugln(ctx context.Context, v ...any) {
|
||||
l.log(ctx, slog.LevelDebug, fmt.Sprintln(v...))
|
||||
}
|
||||
|
||||
func (l slogWithCtx) Debugf(ctx context.Context, format string, v ...any) {
|
||||
l.log(ctx, slog.LevelDebug, fmt.Sprintf(format, v...))
|
||||
}
|
||||
|
||||
func (l slogWithCtx) Printf(ctx context.Context, format string, v ...any) {
|
||||
l.log(ctx, slog.LevelInfo, fmt.Sprintf(format, v...))
|
||||
}
|
||||
|
||||
+2
-2
@@ -44,11 +44,11 @@ func configureFeatures(ctx context.Context) (err error) {
|
||||
for _, feature := range config.Features {
|
||||
switch feature {
|
||||
// Work-in-progress features:
|
||||
case "preview", "existence-cache":
|
||||
case "preview":
|
||||
// Permanently unstable features:
|
||||
case "codeberg-pages-compat", "relaxed-idna":
|
||||
// Stabilized features:
|
||||
case "archive-site", "audit", "compress", "patch", "serve-h2c":
|
||||
case "archive-site", "audit", "compress", "patch", "serve-h2c", "existence-cache":
|
||||
logc.Printf(ctx, "feature %s has been stabilized", feature)
|
||||
// Removed or renamed features:
|
||||
case "h2c", "sentry-telemetry-buffer", "site-existence-cache", "domain-existence-cache":
|
||||
|
||||
Reference in New Issue
Block a user