com.jimuwd.xian.registry-proxy 1.0.64 → 1.0.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ class ConcurrencyLimiter {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
const limiter = new ConcurrencyLimiter(
|
|
37
|
+
const limiter = new ConcurrencyLimiter(1000);
|
|
38
38
|
function removeEndingSlashAndForceStartingSlash(str) {
|
|
39
39
|
if (!str)
|
|
40
40
|
return '/';
|
|
@@ -214,17 +214,19 @@ async function writeResponseToDownstreamClient(registryInfo, targetUrl, resToDow
|
|
|
214
214
|
};
|
|
215
215
|
downstreamReq.on('close', cleanup);
|
|
216
216
|
// write back body data (chunked probably)
|
|
217
|
-
// pipe upstream body to downstream client
|
|
217
|
+
// pipe upstream body to downstream client
|
|
218
218
|
upstreamResponse.body.pipe(resToDownstreamClient, { end: false });
|
|
219
219
|
upstreamResponse.body
|
|
220
220
|
.on('data', (chunk) => logger.info(`Chunk transferred from ${targetUrl} to downstream client size=${chunk.length}`))
|
|
221
221
|
.on('end', () => {
|
|
222
222
|
logger.info(`Upstream server ${targetUrl} response.body ended.`);
|
|
223
|
+
resToDownstreamClient.end();
|
|
223
224
|
})
|
|
224
225
|
.on('close', () => {
|
|
225
226
|
const errMsg = `Upstream server ${targetUrl} closed connection while transferring data.`;
|
|
226
227
|
logger.error(errMsg);
|
|
227
228
|
// resToDownstreamClient.destroy(new Error(errMsg));
|
|
229
|
+
resToDownstreamClient.destroy();
|
|
228
230
|
})
|
|
229
231
|
.on('error', (err) => {
|
|
230
232
|
const errMsg = `Stream error: ${err.message}`;
|