serum-vial
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -88,2 +88,3 @@ "use strict"; | ||
if (!res.aborted) { | ||
res.writeStatus('200 OK'); | ||
res.writeHeader('content-type', 'application/json'); | ||
@@ -265,3 +266,3 @@ res.end(this._cachedListMarketsResponse); | ||
let retries = 0; | ||
while (ws.getBufferedAmount() > this.MAX_BACKPRESSURE / 2) { | ||
while (ws.getBufferedAmount() > 0) { | ||
await helpers_1.wait(10); | ||
@@ -276,8 +277,13 @@ retries += 1; | ||
if (message !== undefined) { | ||
const status = ws.send(message, false); | ||
if (!status) { | ||
logger_1.logger.log('info', `Send backpressure`, { | ||
status, | ||
bufferedAmount: ws.getBufferedAmount() | ||
}); | ||
const success = ws.send(message, false); | ||
if (!success) { | ||
retries = 0; | ||
while (ws.getBufferedAmount() > 0) { | ||
await helpers_1.wait(10); | ||
retries += 1; | ||
if (retries > 200) { | ||
ws.end(1008, 'Too much backpressure'); | ||
return; | ||
} | ||
} | ||
} | ||
@@ -284,0 +290,0 @@ } |
{ | ||
"name": "serum-vial", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=15" |
@@ -174,2 +174,3 @@ import { getLayoutVersion, Market } from '@project-serum/serum' | ||
if (!res.aborted) { | ||
res.writeStatus('200 OK') | ||
res.writeHeader('content-type', 'application/json') | ||
@@ -328,3 +329,3 @@ res.end(this._cachedListMarketsResponse) | ||
let retries = 0 | ||
while (ws.getBufferedAmount() > this.MAX_BACKPRESSURE / 2) { | ||
while (ws.getBufferedAmount() > 0) { | ||
await wait(10) | ||
@@ -341,8 +342,14 @@ retries += 1 | ||
if (message !== undefined) { | ||
const status = ws.send(message, false) | ||
if (!status) { | ||
logger.log('info', `Send backpressure`, { | ||
status, | ||
bufferedAmount: ws.getBufferedAmount() | ||
}) | ||
const success = ws.send(message, false) | ||
if (!success) { | ||
retries = 0 | ||
while (ws.getBufferedAmount() > 0) { | ||
await wait(10) | ||
retries += 1 | ||
if (retries > 200) { | ||
ws.end(1008, 'Too much backpressure') | ||
return | ||
} | ||
} | ||
} | ||
@@ -349,0 +356,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
276161
4049