Skip to content

Commit 64cd53c

Browse files
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>
1 parent d79aa2d commit 64cd53c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/rest/src/lib/utils/constants.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import process from 'node:process';
22
import { APIVersion } from 'discord-api-types/v10';
3-
import { getGlobalDispatcher } from 'undici';
3+
import { Agent } from 'undici';
44
import type { RESTOptions } from '../REST.js';
55
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-require-imports
66
const Package = require('../../../package.json');
@@ -9,7 +9,11 @@ export const DefaultUserAgent = `DiscordBot (${Package.homepage}, ${Package.vers
99

1010
export const DefaultRestOptions: Required<RESTOptions> = {
1111
get agent() {
12-
return getGlobalDispatcher();
12+
return new Agent({
13+
connect: {
14+
timeout: 30_000,
15+
},
16+
});
1317
},
1418
api: 'https://discord.com/api',
1519
authPrefix: 'Bot',

0 commit comments

Comments
 (0)