Skip to content

Commit a2cfcdb

Browse files
authored
fix: disable keep alive to avoid stale socket reuse (#3471)
1 parent f433ac6 commit a2cfcdb

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

services/libs/database/src/tinybirdClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import axios from 'axios'
2+
import https from 'https'
23

34
export type QueryParams = Record<
45
string,
@@ -29,6 +30,10 @@ export class TinybirdClient {
2930
private host: string
3031
private token: string
3132

33+
private static httpsAgent = new https.Agent({
34+
keepAlive: false, // Disable keep-alive to avoid stale socket reuse
35+
})
36+
3237
constructor() {
3338
this.host = process.env.CROWD_TINYBIRD_BASE_URL ?? 'https://api.tinybird.co'
3439
this.token = process.env.CROWD_TINYBIRD_ACTIVITIES_TOKEN ?? ''
@@ -60,6 +65,7 @@ export class TinybirdClient {
6065
Authorization: `Bearer ${this.token}`,
6166
Accept: 'application/json',
6267
},
68+
httpsAgent: TinybirdClient.httpsAgent,
6369
})
6470

6571
// TODO: check the response type

0 commit comments

Comments
 (0)