Merged in fix/handle-cache-delete-without-hit (pull request #1556)
Don't return from cache deleteKey * Don't return from cache deleteKey Approved-by: Linus Flood
This commit is contained in:
committed by
Linus Flood
parent
6d0f47fd4f
commit
d5b47be2f2
@@ -4,7 +4,7 @@ import { cacheLogger } from "../logger"
|
|||||||
import { API_KEY } from "./client"
|
import { API_KEY } from "./client"
|
||||||
import { getCacheEndpoint } from "./endpoints"
|
import { getCacheEndpoint } from "./endpoints"
|
||||||
|
|
||||||
export async function deleteKey<T>(key: string, opts?: { fuzzy?: boolean }) {
|
export async function deleteKey(key: string, opts?: { fuzzy?: boolean }) {
|
||||||
const perf = performance.now()
|
const perf = performance.now()
|
||||||
const endpoint = getCacheEndpoint(key)
|
const endpoint = getCacheEndpoint(key)
|
||||||
|
|
||||||
@@ -35,9 +35,7 @@ export async function deleteKey<T>(key: string, opts?: { fuzzy?: boolean }) {
|
|||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = (await response.json()) as { data: T }
|
|
||||||
cacheLogger.debug(
|
cacheLogger.debug(
|
||||||
`Delete '${key}' took ${(performance.now() - perf).toFixed(2)}ms`
|
`Delete '${key}' took ${(performance.now() - perf).toFixed(2)}ms`
|
||||||
)
|
)
|
||||||
return data.data
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user