Stabilize existence-cache feature.

Also, make the logging a bit quieter.
This commit is contained in:
Catherine
2026-05-27 02:01:35 +00:00
parent f2811a4947
commit af333e3d15
3 changed files with 18 additions and 12 deletions
+8 -10
View File
@@ -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
}
+8
View File
@@ -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
View File
@@ -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":