mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
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:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user