mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-22 10:33:22 +00:00
Mitigate long loading times on spaces with many files. (#260)
This commit is contained in:
@@ -3,9 +3,12 @@ import * as Sentry from '@sentry/nextjs';
|
||||
const dsn = process.env.SENTRY_DSN;
|
||||
if (dsn) {
|
||||
Sentry.init({
|
||||
dsn,
|
||||
tracesSampleRate: 0.01,
|
||||
debug: false,
|
||||
dsn,
|
||||
integrations: [],
|
||||
enableTracing: false,
|
||||
beforeSendTransaction: () => {
|
||||
return null;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
+10
-2
@@ -3,8 +3,16 @@ import * as Sentry from '@sentry/nextjs';
|
||||
const dsn = process.env.SENTRY_DSN;
|
||||
if (dsn) {
|
||||
Sentry.init({
|
||||
dsn,
|
||||
tracesSampleRate: 0.01,
|
||||
debug: false,
|
||||
dsn,
|
||||
|
||||
// Disable tracing as it creates additional requests in an env where subrequests are limited.
|
||||
enableTracing: false,
|
||||
|
||||
// Disable transactions as it creates additional requests in an env where subrequests are limited.
|
||||
// https://docs.sentry.io/platforms/node/configuration/filtering/#using--3
|
||||
beforeSendTransaction: () => {
|
||||
return null;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -482,6 +482,9 @@ const getRevisionAllFiles = cache(
|
||||
|
||||
return cacheResponse(response, { ...immutableCacheTtl_7days, data: files });
|
||||
},
|
||||
{
|
||||
timeout: 60 * 1000,
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+7
-3
@@ -63,8 +63,14 @@ export function cache<Args extends any[], Result>(
|
||||
|
||||
/** Default ttl (in seconds) */
|
||||
defaultTtl?: number;
|
||||
|
||||
/** When a request to the underlying resource will timeout. */
|
||||
timeout?: number;
|
||||
} = {},
|
||||
): CacheFunction<Args, Result> {
|
||||
// We stop everything after 10s to avoid pending requests
|
||||
const timeout = options.timeout ?? 1000 * 10;
|
||||
|
||||
const revalidate = singletonMap(
|
||||
async (key: string, signal: AbortSignal | undefined, ...args: Args) => {
|
||||
return await trace(
|
||||
@@ -131,9 +137,7 @@ export function cache<Args extends any[], Result>(
|
||||
},
|
||||
{
|
||||
signal,
|
||||
|
||||
// We stop everything after 10s to avoid pending requests
|
||||
timeout: 10 * 1000,
|
||||
timeout,
|
||||
|
||||
// We give 70ms to the caches to respond, otherwise we start fallbacking to the actual fetch
|
||||
// It should represents a bit more than the 90th percentile of the KV cache response time
|
||||
|
||||
Reference in New Issue
Block a user