fix: log jikan cache set failures instead of silently discarding

This commit is contained in:
2026-06-16 00:35:16 +02:00
committed by Milas Holsting
parent aa9375eff2
commit b88a859b66

View File

@@ -346,11 +346,21 @@ func (c *Client) setCache(parentCtx context.Context, key string, data any, ttl t
return
}
_ = c.db.SetJikanCache(ctx, db.SetJikanCacheParams{
err = c.db.SetJikanCache(ctx, db.SetJikanCacheParams{
Key: key,
Data: string(bytes),
ExpiresAt: time.Now().Add(ttl),
})
if err != nil {
observability.LogJSON(
observability.LogLevelError,
"jikan_cache_set",
"jikan",
"",
map[string]any{"cache_key": key},
err,
)
}
}
// isEmptyResult detects if response contains no meaningful data.