Closed orgrimarr closed 3 years ago
This is intentional. ECONNRESET
can occur after a requests has started processing. Retrying the request could result in data loss or corruption. ECONNREFUSED
can only occur before the request has been started processing, so it can be retried safely.
FYI arangojs 7.3.0 now sets the default agentOptions
socket reuse to lifo
which should reduce the likelihood of encountering connection timeouts when making infrequent requests. This will not prevent this from happening but it should be less frequent on versions of Node where this is not the default.
Environment
Description
The arangojs lib in ROUND_ROBIN mode can failover to another arango in case of ECONNREFUSED error.
When an arango server shutting down or du to network issue, an ECONNRESET error may occure.
This error is not handled by arangojs and throw an error instead of retrying
Steps to reproduce
const test = async function(){ const db = new arangojs.Database({ url: ['https://127.0.0.1:9001', 'https://127.0.0.1:9002', 'https://127.0.0.1:9003'], maxRetries: 3, databaseName: '_system', loadBalancingStrategy: "ROUND_ROBIN", agentOptions: { rejectUnauthorized: false } })
}
test() .catch(console.error)
Steps
Error
Proposition