Skip to content

Commit

Permalink
feat(rest): use Agent with higher connect timeout (#8679)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
KhafraDev and kodiakhq[bot] committed Sep 25, 2022
1 parent d79aa2d commit 64cd53c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/rest/src/lib/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -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',
Expand Down

0 comments on commit 64cd53c

Please sign in to comment.