increase keepAliveTimeout

This commit is contained in:
wphan
2023-11-24 14:20:58 -08:00
parent 1e3ebb4576
commit f1504a7404

View File

@@ -12,7 +12,6 @@ import {
DriftClient, DriftClient,
initialize, initialize,
DriftEnv, DriftEnv,
SlotSubscriber,
UserMap, UserMap,
DLOBOrder, DLOBOrder,
DLOBOrders, DLOBOrders,
@@ -104,6 +103,13 @@ app.use((req, _res, next) => {
app.use(errorHandler); app.use(errorHandler);
const server = http.createServer(app); const server = http.createServer(app);
// Default keepalive is 5s, since the AWS ALB timeout is 60 seconds, clients
// sometimes get 502s.
// https://shuheikagawa.com/blog/2019/04/25/keep-alive-timeout/
// https://stackoverflow.com/a/68922692
server.keepAliveTimeout = 61 * 1000;
server.headersTimeout = 65 * 1000;
const opts = program.opts(); const opts = program.opts();
setLogLevel(opts.debug ? 'debug' : 'info'); setLogLevel(opts.debug ? 'debug' : 'info');
@@ -212,11 +218,7 @@ const main = async () => {
await userMap.subscribe(); await userMap.subscribe();
const userStatsMap = new UserStatsMap(driftClient, { const userStatsMap = new UserStatsMap(driftClient, {
type: 'polling', type: 'polling',
accountLoader: new BulkAccountLoader( accountLoader: new BulkAccountLoader(connection, stateCommitment, 0),
connection,
stateCommitment,
0
),
}); });
await userStatsMap.subscribe(); await userStatsMap.subscribe();