cloudcms-server 4.0.0-beta.21 → 4.0.0-beta.22

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/index.js CHANGED
@@ -60,27 +60,38 @@ process.logInfo = process.log = function(text, level)
60
60
  // by default, set up Gitana driver so that it limits to five concurrent HTTP requests back to Cloud CMS API at at time
61
61
  var Gitana = require("gitana");
62
62
 
63
+ // default http timeout (10 minutes)
64
+ process.defaultHttpTimeoutMs = 10 * 60 * 1000;
65
+ if (process.env.DEFAULT_HTTP_TIMEOUT_MS)
66
+ {
67
+ try {
68
+ process.defaultHttpTimeoutMs = parseInt(process.env.DEFAULT_HTTP_TIMEOUT_MS);
69
+ } catch (e) { }
70
+ }
71
+
63
72
  // default keep alive (3 minutes)
64
73
  process.defaultKeepAliveMs = (3 * 60 * 1000);
65
-
66
- // default http timeout (2 minutes)
67
- process.defaultHttpTimeoutMs = 2 * 60 * 1000;
74
+ if (process.env.DEFAULT_KEEP_ALIVE_MS)
75
+ {
76
+ try {
77
+ process.defaultKeepAliveMs = parseInt(process.env.DEFAULT_KEEP_ALIVE_MS);
78
+ } catch (e) { }
79
+ }
68
80
 
69
81
  // default exclusive lock timeout (2 minutes)
70
82
  process.defaultExclusiveLockTimeoutMs = 2 * 60 * 1000;
71
-
72
- if (process.env.DEFAULT_HTTP_TIMEOUT_MS)
83
+ if (process.env.DEFAULT_EXCLUSIVE_LOCK_TIMEOUT_MS)
73
84
  {
74
- try
75
- {
76
- process.defaultHttpTimeoutMs = parseInt(process.env.DEFAULT_HTTP_TIMEOUT_MS);
77
- }
78
- catch (e)
79
- {
80
-
81
- }
85
+ try {
86
+ process.defaultExclusiveLockTimeoutMs = parseInt(process.env.DEFAULT_EXCLUSIVE_LOCK_TIMEOUT_MS);
87
+ } catch (e) { }
82
88
  }
83
89
 
90
+ // some reporting
91
+ console.log("process.defaultHttpTimeoutMs: " + process.defaultHttpTimeoutMs);
92
+ console.log("process.defaultKeepAliveMs: " + process.defaultKeepAliveMs);
93
+ console.log("process.defaultExclusiveLockTimeoutMs: " + process.defaultExclusiveLockTimeoutMs);
94
+
84
95
  // dns fix for Node 17 +
85
96
  // see: https://nodejs.org/api/dns.html#dnssetdefaultresultorderorder
86
97
  var dns = require("dns");
@@ -94,18 +105,18 @@ var HttpsKeepAliveAgent = require('agentkeepalive').HttpsAgent;
94
105
  http.globalAgent = new HttpKeepAliveAgent({
95
106
  keepAlive: true,
96
107
  keepAliveMsecs: process.defaultKeepAliveMs,
97
- maxSockets: 1024,
98
- maxFreeSockets: 256,
108
+ maxSockets: 2048,
109
+ maxFreeSockets: 64,
99
110
  timeout: process.defaultHttpTimeoutMs,
100
- freeSocketTimeout: 5000
111
+ freeSocketTimeout: 30000
101
112
  });
102
113
  https.globalAgent = new HttpsKeepAliveAgent({
103
114
  keepAlive: true,
104
115
  keepAliveMsecs: process.defaultKeepAliveMs,
105
- maxSockets: 1024,
106
- maxFreeSockets: 256,
116
+ maxSockets: 2048,
117
+ maxFreeSockets: 64,
107
118
  timeout: process.defaultHttpTimeoutMs,
108
- freeSocketTimeout: 5000
119
+ freeSocketTimeout: 30000
109
120
  });
110
121
 
111
122
  // install dns cache
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "name": "cloudcms-server",
8
8
  "description": "Cloud CMS Application Server Module",
9
- "version": "4.0.0-beta.21",
9
+ "version": "4.0.0-beta.22",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "git://github.com/gitana/cloudcms-server.git"
@@ -16,7 +16,7 @@
16
16
  "@socket.io/redis-adapter": "^8.3.0",
17
17
  "@socket.io/sticky": "^1.0.4",
18
18
  "accepts": "^1.3.8",
19
- "agentkeepalive": "^4.5.0",
19
+ "agentkeepalive": "^4.6.0",
20
20
  "alpaca": "^1.5.27",
21
21
  "archiver": "^7.0.1",
22
22
  "async": "^3.2.6",
package/server/index.js CHANGED
@@ -587,42 +587,11 @@ var _start = function(overrides, callback) {
587
587
  process.env.CLOUDCMS_STANDALONE_HOST = "local";
588
588
  }
589
589
 
590
- // http timeout
591
- // default http timeout (2 minutes)
592
- process.defaultHttpTimeoutMs = 2 * 60 * 1000;
593
- if (process.env.DEFAULT_HTTP_TIMEOUT_MS)
594
- {
595
- try {
596
- process.defaultHttpTimeoutMs = parseInt(process.env.DEFAULT_HTTP_TIMEOUT_MS);
597
- } catch (e) { }
598
- }
599
- else if (process.configuration.timeout)
600
- {
601
- process.defaultHttpTimeoutMs = process.configuration.timeout;
602
- }
603
-
604
- // socket keep alive (3 minutes)
605
- process.defaultKeepAliveMs = (3 * 60 * 1000);
606
- if (process.env.DEFAULT_KEEP_ALIVE_MS)
607
- {
608
- try {
609
- process.defaultKeepAliveMs = parseInt(process.env.DEFAULT_KEEP_ALIVE_MS);
610
- } catch (e) { }
611
- }
612
- else if (process.configuration.keepAliveMs)
613
- {
614
- process.defaultKeepAliveMs = process.configuration.keepAliveMs;
615
- }
616
590
 
617
-
618
- ///////////////////////
619
591
  // auto-configuration for HTTPS
620
- ///////////////////////
621
-
622
592
  if (!process.configuration.https) {
623
593
  process.configuration.https = {};
624
594
  }
625
-
626
595
  if (process.env.CLOUDCMS_HTTPS) {
627
596
  process.configuration.https = JSON.parse(process.env.CLOUDCMS_HTTPS);
628
597
  }
@@ -77,6 +77,13 @@ var createProxyHandler = function(proxyTarget, pathPrefix)
77
77
  const { proxy, close } = require('fast-proxy')({
78
78
  base: proxyTarget,
79
79
  cacheURLs: 0,
80
+ keepAlive: true,
81
+ keepAliveMsecs: process.defaultKeepAliveMs,
82
+ maxSockets: 2048,
83
+ maxFreeSockets: 64,
84
+ timeout: process.defaultHttpTimeoutMs,
85
+ freeSocketTimeout: 30000
86
+
80
87
  //http2: true,
81
88
  //undici: true
82
89
  });