diff --git a/app/integrations/useIntegrations.ts b/app/integrations/useIntegrations.ts new file mode 100644 index 0000000..5916ba6 --- /dev/null +++ b/app/integrations/useIntegrations.ts @@ -0,0 +1,12 @@ +const FETCH_TIMEOUT = 10000; // 10 seconds +@@ -15,0 +17,5 @@ +function fetchWithTimeout(resource, options = {}) { + const { timeout = FETCH_TIMEOUT } = options; + return Promise.race([ + fetch(resource, options), + new Promise((_, reject) => setTimeout(() => reject(new Error('timeout')), timeout)) + ]); +} +@@ -30,1 +37,1 @@ +-fetch(url) +fetchWithTimeout(url) diff --git a/next.config.mjs b/next.config.mjs index 3aaaa5c..815c8b0 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,5 +1,6 @@ import { withSentryConfig } from "@sentry/nextjs"; import remarkGfm from "remark-gfm"; + performance: { hints: false }, import createMDX from "@next/mdx"; /** @type {import('next').NextConfig} */ diff --git a/useIntegrations.ts b/useIntegrations.ts new file mode 100644 index 0000000..7779592 --- /dev/null +++ b/useIntegrations.ts @@ -0,0 +1,11 @@ +const WEBSOCKET_TIMEOUT = 10000; // 10 seconds +@@ -20,0 +22,5 @@ +function handleWebSocketTimeout(socket) { + setTimeout(() => { + if (socket.readyState === WebSocket.CONNECTING) { + socket.close(); + } + }, WEBSOCKET_TIMEOUT); +} +@@ -50,0 +57,1 @@ + handleWebSocketTimeout(socket);