Skip to content

Commit cebeda0

Browse files
authored
fix: disable http keep-alive for stacks-node /v2 proxied endpoints
1 parent 735874e commit cebeda0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/api/routes/core-node-rpc-proxy.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ export function createCoreNodeRpcProxyRouter(): express.Router {
2525

2626
logger.info(`/v2/* proxying to: ${stacksNodeRpcEndpoint}`);
2727

28+
// Note: while keep-alive may result in some performance improvements with the stacks-node http server,
29+
// it can also cause request distribution issues when proxying to a pool of stacks-nodes. See:
30+
// https://github.com/blockstack/stacks-blockchain-api/issues/756
2831
const httpAgent = new Agent({
29-
keepAlive: true,
30-
keepAliveMsecs: 60000,
32+
// keepAlive: true,
33+
keepAlive: false, // `false` is the default -- set it explicitly for readability anyway.
34+
// keepAliveMsecs: 60000,
3135
maxSockets: 200,
3236
maxTotalSockets: 400,
3337
});

0 commit comments

Comments
 (0)