From 64cd53c4c23dd9c9503fd0887ac5c542137c57e8 Mon Sep 17 00:00:00 2001 From: Khafra <42794878+KhafraDev@users.noreply.github.com> Date: Sun, 25 Sep 2022 08:45:36 -0400 Subject: [PATCH] feat(rest): use Agent with higher connect timeout (#8679) * feat(rest): use Agent with higher connect timeout * chore: lint * chore: I'm an idiot Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- packages/rest/src/lib/utils/constants.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/rest/src/lib/utils/constants.ts b/packages/rest/src/lib/utils/constants.ts index 296016370e2c..0a5854cf293b 100644 --- a/packages/rest/src/lib/utils/constants.ts +++ b/packages/rest/src/lib/utils/constants.ts @@ -1,6 +1,6 @@ import process from 'node:process'; import { APIVersion } from 'discord-api-types/v10'; -import { getGlobalDispatcher } from 'undici'; +import { Agent } from 'undici'; import type { RESTOptions } from '../REST.js'; // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports const Package = require('../../../package.json'); @@ -9,7 +9,11 @@ export const DefaultUserAgent = `DiscordBot (${Package.homepage}, ${Package.vers export const DefaultRestOptions: Required = { get agent() { - return getGlobalDispatcher(); + return new Agent({ + connect: { + timeout: 30_000, + }, + }); }, api: 'https://discord.com/api', authPrefix: 'Bot',