Merged in fix/limit-time-to-response-for-cache-calls (pull request #1990)
fix: add timeout for redis-api calls SW-2635 Approved-by: Michael Zetterberg
This commit is contained in:
@@ -17,10 +17,11 @@ export async function get<T>(key: string) {
|
||||
headers: {
|
||||
"x-api-key": API_KEY,
|
||||
},
|
||||
signal: AbortSignal.timeout(3_000),
|
||||
})
|
||||
)
|
||||
|
||||
if (!response || error || !response.ok) {
|
||||
if (!response || !response.ok || error) {
|
||||
if (response?.status === 404) {
|
||||
cacheLogger.debug(
|
||||
`Miss '${key}' took ${(performance.now() - perf).toFixed(2)}ms`
|
||||
@@ -28,11 +29,9 @@ export async function get<T>(key: string) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
Sentry.captureMessage("Unable to GET cachekey", {
|
||||
level: "error",
|
||||
Sentry.captureException(error ?? new Error("Unable to GET cachekey"), {
|
||||
extra: {
|
||||
cacheKey: key,
|
||||
errorMessage: error instanceof Error ? error.message : undefined,
|
||||
statusCode: response?.status,
|
||||
statusText: response?.statusText,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user