Skip to content

Commit

Permalink
feat: added custom http agent to superagent
Browse files Browse the repository at this point in the history
  • Loading branch information
eddienubes committed Feb 11, 2024
1 parent ed56a39 commit 9cf1023
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion benchmarks/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const { Pool, Client, fetch, Agent, setGlobalDispatcher } = require('..')

let nodeFetch
const axios = require('axios')
const superagent = require('superagent')
let superagent
let got

const util = require('node:util')
Expand Down Expand Up @@ -86,6 +86,11 @@ const requestAgent = new http.Agent({
maxSockets: connections
})

const superagentAgent = new http.Agent({
keepAlive: true,
maxSockets: connections
})

const undiciOptions = {
path: '/',
method: 'GET',
Expand Down Expand Up @@ -337,6 +342,9 @@ async function main () {
nodeFetch = _nodeFetch.default
const _got = await import('got')
got = _got.default
const _superagent = await import('superagent')
// https://github.com/ladjs/superagent/issues/1540#issue-561464561
superagent = _superagent.agent().use((req) => req.agent(superagentAgent))

cronometro(
experiments,
Expand Down

0 comments on commit 9cf1023

Please sign in to comment.