com.jimuwd.xian.registry-proxy 1.0.68 → 1.0.70

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.
Files changed (2) hide show
  1. package/dist/index.js +8 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -218,10 +218,10 @@ async function writeResponseToDownstreamClient(registryInfo, targetUrl, resToDow
218
218
  // clean up when server closes connection to downstream client.
219
219
  const cleanup0 = () => {
220
220
  resToDownstreamClient.off('close', cleanup0);
221
- logger.info(`Downstream client closed connection, destroy connection, upstream url is ${targetUrl}`);
221
+ logger.info(`Close connection to downstream client, destroy connection, upstream url is ${targetUrl}`);
222
222
  /*upstreamResponse.body?.unpipe(); 代理服务器主动关闭与客户端的连接,不需要此时对接管道已经断开了,没必要重复断开*/
223
- resToDownstreamClient.destroy();
224
- reqFromDownstreamClient.destroy();
223
+ // resToDownstreamClient.destroy();
224
+ // reqFromDownstreamClient.destroy();
225
225
  };
226
226
  resToDownstreamClient.on('close', cleanup0);
227
227
  // write back body data (chunked probably)
@@ -335,6 +335,11 @@ export async function startProxyServer(proxyConfigPath, localYarnConfigPath, glo
335
335
  logger.error('Server error:', err);
336
336
  reject(err);
337
337
  });
338
+ server.on('connection', (socket) => {
339
+ logger.debug("Server on connection");
340
+ socket.setTimeout(60000);
341
+ socket.setKeepAlive(true, 30000);
342
+ });
338
343
  server.listen(port, () => {
339
344
  const address = server.address();
340
345
  proxyPort = address.port;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.jimuwd.xian.registry-proxy",
3
- "version": "1.0.68",
3
+ "version": "1.0.70",
4
4
  "description": "A lightweight npm registry proxy with fallback support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",