fix(cassandra): bound driver in-flight requests per connection (#2122)

This commit is contained in:
Hampus
2026-08-30 22:15:02 +02:00
committed by GitHub
parent 3e74180bdc
commit 36dcf51024
3 changed files with 70 additions and 7 deletions
+7 -1
View File
@@ -6,6 +6,9 @@ import cassandra from 'cassandra-driver';
const distance = cassandra.types.distance;
const MAX_REQUESTS_PER_CONNECTION = 2048;
const READ_TIMEOUT_MS = 12000;
interface CassandraConfig {
hosts: Array<string>;
port?: number | undefined;
@@ -83,12 +86,15 @@ class CassandraClient implements ICassandraClient {
port: this.config.port ?? 9042,
},
pooling: {
maxRequestsPerConnection: 32768,
maxRequestsPerConnection: MAX_REQUESTS_PER_CONNECTION,
coreConnectionsPerHost: {
[distance.local]: 4,
[distance.remote]: 2,
},
},
socketOptions: {
readTimeout: READ_TIMEOUT_MS,
},
encoding: {
map: Map,
set: Set,