fix: bound stale jikan cache reads
This commit is contained in:
@@ -233,7 +233,7 @@ WHERE key = ? AND datetime(expires_at) > CURRENT_TIMESTAMP LIMIT 1;
|
|||||||
|
|
||||||
-- name: GetJikanCacheStale :one
|
-- name: GetJikanCacheStale :one
|
||||||
SELECT data FROM jikan_cache
|
SELECT data FROM jikan_cache
|
||||||
WHERE key = ? LIMIT 1;
|
WHERE key = ? AND datetime(expires_at) > datetime(CURRENT_TIMESTAMP, '-14 days') LIMIT 1;
|
||||||
|
|
||||||
-- name: SetJikanCache :exec
|
-- name: SetJikanCache :exec
|
||||||
INSERT INTO jikan_cache (key, data, expires_at)
|
INSERT INTO jikan_cache (key, data, expires_at)
|
||||||
|
|||||||
@@ -578,7 +578,7 @@ func (q *Queries) GetJikanCache(ctx context.Context, key string) (string, error)
|
|||||||
|
|
||||||
const getJikanCacheStale = `-- name: GetJikanCacheStale :one
|
const getJikanCacheStale = `-- name: GetJikanCacheStale :one
|
||||||
SELECT data FROM jikan_cache
|
SELECT data FROM jikan_cache
|
||||||
WHERE key = ? LIMIT 1
|
WHERE key = ? AND datetime(expires_at) > datetime(CURRENT_TIMESTAMP, '-14 days') LIMIT 1
|
||||||
`
|
`
|
||||||
|
|
||||||
func (q *Queries) GetJikanCacheStale(ctx context.Context, key string) (string, error) {
|
func (q *Queries) GetJikanCacheStale(ctx context.Context, key string) (string, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user