cloudcms-server 3.2.306 → 3.2.307
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 +4 -4
- package/middleware/runtime/runtime.js +2 -3
- package/package.json +1 -1
- package/server/index.js +11 -11
- package/util/loaders.js +11 -2
- package/util/proxy-factory.js +3 -3
package/index.js
CHANGED
|
@@ -67,18 +67,18 @@ var HttpsKeepAliveAgent = require('agentkeepalive').HttpsAgent;
|
|
|
67
67
|
http.globalAgent = new HttpKeepAliveAgent({
|
|
68
68
|
keepAlive: true,
|
|
69
69
|
keepAliveMsecs: process.defaultKeepAliveMs,
|
|
70
|
-
maxSockets:
|
|
70
|
+
maxSockets: 1024,
|
|
71
71
|
maxFreeSockets: 256,
|
|
72
72
|
timeout: process.defaultHttpTimeoutMs,
|
|
73
|
-
freeSocketTimeout:
|
|
73
|
+
freeSocketTimeout: 5000
|
|
74
74
|
});
|
|
75
75
|
https.globalAgent = new HttpsKeepAliveAgent({
|
|
76
76
|
keepAlive: true,
|
|
77
77
|
keepAliveMsecs: process.defaultKeepAliveMs,
|
|
78
|
-
maxSockets:
|
|
78
|
+
maxSockets: 1024,
|
|
79
79
|
maxFreeSockets: 256,
|
|
80
80
|
timeout: process.defaultHttpTimeoutMs,
|
|
81
|
-
freeSocketTimeout:
|
|
81
|
+
freeSocketTimeout: 5000
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
// install dns cache
|
|
@@ -226,10 +226,9 @@ exports = module.exports = function()
|
|
|
226
226
|
}(store);
|
|
227
227
|
|
|
228
228
|
// wrap loader with caching + an exclusive lock
|
|
229
|
-
var
|
|
230
|
-
var exclusiveLoader = Loaders.exclusive(cachedLoader, key, process.defaultExclusiveLockTimeoutMs);
|
|
229
|
+
var cachedExclusiveLoader = Loaders.cachedExclusive(loader, process.runtimeCache, key, process.defaultExclusiveLockTimeoutMs);
|
|
231
230
|
|
|
232
|
-
|
|
231
|
+
cachedExclusiveLoader(callback);
|
|
233
232
|
};
|
|
234
233
|
|
|
235
234
|
return util.createInterceptor("runtime", function(req, res, next, stores, cache, configuration) {
|
package/package.json
CHANGED
package/server/index.js
CHANGED
|
@@ -785,16 +785,16 @@ var startServer = function(config, startServerFinishedFn)
|
|
|
785
785
|
f(req, res, function() {
|
|
786
786
|
var totalTime = process.hrtime(startTime);
|
|
787
787
|
var totalTimeMs = (totalTime[1] / 1000000).toFixed(2);
|
|
788
|
-
if (totalTimeMs > 100)
|
|
789
|
-
{
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
}
|
|
788
|
+
// if (totalTimeMs > 100)
|
|
789
|
+
// {
|
|
790
|
+
// if (id)
|
|
791
|
+
// {
|
|
792
|
+
// console.log("[" + id + "](" + functionName + ") time: " + totalTimeMs);
|
|
793
|
+
// }
|
|
794
|
+
//
|
|
795
|
+
// //console.trace();
|
|
796
|
+
// //process.exit(-1);
|
|
797
|
+
// }
|
|
798
798
|
|
|
799
799
|
next();
|
|
800
800
|
});
|
|
@@ -986,7 +986,7 @@ var startServer = function(config, startServerFinishedFn)
|
|
|
986
986
|
message = "\r\n**** SLOW RESPONSE ****\r\n" + message + "\r\n";
|
|
987
987
|
}
|
|
988
988
|
*/
|
|
989
|
-
|
|
989
|
+
|
|
990
990
|
console.log(message);
|
|
991
991
|
};
|
|
992
992
|
|
package/util/loaders.js
CHANGED
|
@@ -22,7 +22,7 @@ var SENTINEL_NOT_FOUND_VALUE = "null";
|
|
|
22
22
|
* @param cache
|
|
23
23
|
* @param key
|
|
24
24
|
*/
|
|
25
|
-
exports.cached = function(loader, cache, key)
|
|
25
|
+
var cached = exports.cached = function(loader, cache, key)
|
|
26
26
|
{
|
|
27
27
|
return function(callback)
|
|
28
28
|
{
|
|
@@ -76,7 +76,7 @@ var lock = new AsyncLock();
|
|
|
76
76
|
* @param loader
|
|
77
77
|
* @param key
|
|
78
78
|
*/
|
|
79
|
-
exports.exclusive = function(loader, key, timeout)
|
|
79
|
+
var exclusive = exports.exclusive = function(loader, key, timeout)
|
|
80
80
|
{
|
|
81
81
|
return function(callback)
|
|
82
82
|
{
|
|
@@ -97,3 +97,12 @@ exports.exclusive = function(loader, key, timeout)
|
|
|
97
97
|
}, opts);
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
|
+
|
|
101
|
+
var cachedExclusive = exports.cachedExclusive = function(loader, cache, key, timeout)
|
|
102
|
+
{
|
|
103
|
+
var cachedLoader1 = cached(loader, cache, key);
|
|
104
|
+
var exclusiveLoader = exclusive(cachedLoader1, key, timeout);
|
|
105
|
+
var cachedLoader2 = cached(exclusiveLoader, cache, key);
|
|
106
|
+
|
|
107
|
+
return cachedLoader2;
|
|
108
|
+
};
|
package/util/proxy-factory.js
CHANGED
|
@@ -47,10 +47,10 @@ var createProxyHandler = function(proxyTarget, pathPrefix)
|
|
|
47
47
|
cacheURLs: 0,
|
|
48
48
|
keepAlive: true,
|
|
49
49
|
keepAliveMsecs: process.defaultKeepAliveMs,
|
|
50
|
-
maxSockets:
|
|
51
|
-
maxFreeSockets:
|
|
50
|
+
maxSockets: 1024,
|
|
51
|
+
maxFreeSockets: 256,
|
|
52
52
|
timeout: process.defaultHttpTimeoutMs,
|
|
53
|
-
freeSocketTimeout:
|
|
53
|
+
freeSocketTimeout: 5000
|
|
54
54
|
|
|
55
55
|
//http2: true,
|
|
56
56
|
//undici: true
|