Merge pull request #20 from Permissionless-Software-Foundation/ct-unstable

fix(timouts): Adjusting network timeout settings
This commit is contained in:
Chris Troutner
2026-03-12 12:46:21 -07:00
committed by GitHub
5 changed files with 22 additions and 12 deletions
+5
View File
@@ -246,6 +246,11 @@ class Server {
wlogger.info(`Server started on port ${this.config.port}`) wlogger.info(`Server started on port ${this.config.port}`)
}) })
// Explicit timeout settings reduce stale keep-alive socket reuse races.
this.server.keepAliveTimeout = this.config.serverKeepAliveTimeoutMs
this.server.headersTimeout = this.config.serverHeadersTimeoutMs
this.server.requestTimeout = this.config.serverRequestTimeoutMs
this.server.on('error', (err) => { this.server.on('error', (err) => {
console.error('Server error:', err) console.error('Server error:', err)
wlogger.error('Server error:', err) wlogger.error('Server error:', err)
+9 -9
View File
@@ -9,12 +9,12 @@
"version": "7.0.0", "version": "7.0.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@psf/bch-js": "7.1.11", "@psf/bch-js": "7.1.14",
"axios": "1.7.7", "axios": "1.7.7",
"cors": "2.8.5", "cors": "2.8.5",
"dotenv": "16.3.1", "dotenv": "16.3.1",
"express": "5.1.0", "express": "5.1.0",
"minimal-slp-wallet": "7.1.4", "minimal-slp-wallet": "7.1.5",
"psffpp": "1.2.1", "psffpp": "1.2.1",
"slp-token-media": "1.2.10", "slp-token-media": "1.2.10",
"winston": "3.11.0", "winston": "3.11.0",
@@ -858,9 +858,9 @@
} }
}, },
"node_modules/@psf/bch-js": { "node_modules/@psf/bch-js": {
"version": "7.1.11", "version": "7.1.14",
"resolved": "https://registry.npmjs.org/@psf/bch-js/-/bch-js-7.1.11.tgz", "resolved": "https://registry.npmjs.org/@psf/bch-js/-/bch-js-7.1.14.tgz",
"integrity": "sha512-gDJCaY2aG8EtUWcR9D4tbiyM1BkHd7gkuO7NRaLpwdbSrnU51lyPr69mjQLKOcVlL+aXdJsOjL5pm15t4zq18w==", "integrity": "sha512-B/NXuxSoOHgMR0tHyY8qpXN3VDATeBhd6qhasJsiEjb22IGIjsXsdJ0oZR2DLnn/1UA+94+XJNyVz2UlcaqEpw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@chris.troutner/bip32-utils": "1.0.5", "@chris.troutner/bip32-utils": "1.0.5",
@@ -6475,13 +6475,13 @@
} }
}, },
"node_modules/minimal-slp-wallet": { "node_modules/minimal-slp-wallet": {
"version": "7.1.4", "version": "7.1.5",
"resolved": "https://registry.npmjs.org/minimal-slp-wallet/-/minimal-slp-wallet-7.1.4.tgz", "resolved": "https://registry.npmjs.org/minimal-slp-wallet/-/minimal-slp-wallet-7.1.5.tgz",
"integrity": "sha512-oHPDu+dUyAT8YOyKvb6JGZYIoalXAEHvcAUby7OgL3D/5R+cR21FTjpqpp7BJp+NFcGRANohnLAqpP2vt6tgFA==", "integrity": "sha512-dROdawFZJZLvyTRndJi987S+z0cOG9k6coyyTAfkaaQftP+UayjUyjKeQlJVrKAPgIzxhk6EoZKD6AtoGjwQrw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@chris.troutner/retry-queue": "1.0.11", "@chris.troutner/retry-queue": "1.0.11",
"@psf/bch-js": "7.1.11", "@psf/bch-js": "7.1.14",
"bch-consumer": "1.6.2", "bch-consumer": "1.6.2",
"bch-donation": "1.1.2", "bch-donation": "1.1.2",
"crypto-js": "4.0.0" "crypto-js": "4.0.0"
+2 -2
View File
@@ -15,12 +15,12 @@
"license": "MIT", "license": "MIT",
"description": "REST API proxy to Bitcoin Cash infrastructure", "description": "REST API proxy to Bitcoin Cash infrastructure",
"dependencies": { "dependencies": {
"@psf/bch-js": "7.1.11", "@psf/bch-js": "7.1.14",
"axios": "1.7.7", "axios": "1.7.7",
"cors": "2.8.5", "cors": "2.8.5",
"dotenv": "16.3.1", "dotenv": "16.3.1",
"express": "5.1.0", "express": "5.1.0",
"minimal-slp-wallet": "7.1.4", "minimal-slp-wallet": "7.1.5",
"psffpp": "1.2.1", "psffpp": "1.2.1",
"slp-token-media": "1.2.10", "slp-token-media": "1.2.10",
"winston": "3.11.0", "winston": "3.11.0",
+5
View File
@@ -47,6 +47,11 @@ export default {
// Server port // Server port
port: parseInt(process.env.PORT, 10) || 5942, port: parseInt(process.env.PORT, 10) || 5942,
// HTTP server connection lifecycle configuration.
serverKeepAliveTimeoutMs: Number(process.env.SERVER_KEEPALIVE_TIMEOUT_MS || 3000),
serverHeadersTimeoutMs: Number(process.env.SERVER_HEADERS_TIMEOUT_MS || 65000),
serverRequestTimeoutMs: Number(process.env.SERVER_REQUEST_TIMEOUT_MS || 120000),
// Environment // Environment
env: process.env.NODE_ENV || 'development', env: process.env.NODE_ENV || 'development',
+1 -1
View File
@@ -146,7 +146,7 @@ class FulcrumUseCases {
if (response.transactions && Array.isArray(response.transactions)) { if (response.transactions && Array.isArray(response.transactions)) {
// Use bearer token from request if provided, otherwise use the default bchjs instance // Use bearer token from request if provided, otherwise use the default bchjs instance
let bchjsInstance = this.bchjs let bchjsInstance = this.bchjs
// console.log('getTransactionsBulk() bearerToken: ', bearerToken) // console.log('getTransactionsBulk() bearerToken: ', bearerToken)
if (bearerToken) { if (bearerToken) {
// Create a temporary bchjs instance with the bearer token from the request // Create a temporary bchjs instance with the bearer token from the request