Skip to content

Commit

Permalink
Add undici timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
synzen committed Jan 28, 2024
1 parent 751e53a commit aaa316b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
35 changes: 34 additions & 1 deletion services/feed-requests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion services/feed-requests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
"redis": "^4.6.7",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0"
"rxjs": "^7.2.0",
"undici": "^6.5.0"
},
"devDependencies": {
"@mikro-orm/cli": "^5.7.5",
Expand Down
7 changes: 7 additions & 0 deletions services/feed-requests/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import dotenv from 'dotenv';
import path from 'path';
import { testConfig } from './test.config';
import { Environment, EnvironmentVariables, validateConfig } from './validate';
import { setGlobalDispatcher, Agent } from 'undici';

const envFiles: Record<string, string> = {
development: '.env.development',
Expand Down Expand Up @@ -54,6 +55,12 @@ export default function config(): EnvironmentVariables {
),
};

setGlobalDispatcher(
new Agent({
connect: { timeout: values.FEED_REQUESTS_REQUEST_TIMEOUT_MS },
}),
);

validateConfig(values);

return values;
Expand Down

0 comments on commit aaa316b

Please sign in to comment.