Skip to content

Commit 4f3cf78

Browse files
croakyiampogo
authored andcommitted
sdk/node: enable Keep-Alive in HTTP agent
Don't re-negotiate TLS for each request. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive Closes #3383 Author: Dan Croak <dan@statusok.com> Date: Wed Apr 18 10:25:43 2018 -0700 upstream:faf2b90112a5a3a090ffa141bf4afba085e90755
1 parent f2c1d0e commit 4f3cf78

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Sequence Node SDK changelog
22

3+
## 2.0.0-rc.3 (201804??)
4+
5+
* Enable `keepAlive` on the HTTP agent.
6+
37
## 2.0.0-rc.2 (20180416)
48

59
* Omit deprecated attributes returned from the API from all response objects.
@@ -10,6 +14,10 @@
1014
* Removed assets, balances, contracts, and all other deprecated code.
1115
* Added `Stats#ledgerType`.
1216

17+
## 1.5.1 (20180417)
18+
19+
* Enable `keepAlive` on the HTTP agent.
20+
1321
## 1.5.0 (20180316)
1422

1523
For full details on the 1.5 release and how to migrate your code,

src/connection.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,12 @@ export class Connection {
195195
const cafile = process.env.SEQTLSCA
196196
if (cafile) {
197197
req.agent = new Agent({ ca: readFileSync(cafile) })
198+
} else {
199+
req.agent = new Agent()
198200
}
199201

202+
req.agent.keepAlive = true
203+
200204
let resp: Response
201205

202206
try {

0 commit comments

Comments
 (0)