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>
This commit is contained in:
Khafra
2022-09-25 08:45:36 -04:00
committed by GitHub
parent d79aa2d0d0
commit 64cd53c4c2

View File

@@ -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<RESTOptions> = {
get agent() {
return getGlobalDispatcher();
return new Agent({
connect: {
timeout: 30_000,
},
});
},
api: 'https://discord.com/api',
authPrefix: 'Bot',