cloudcms-server 3.2.281 → 3.2.282

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
@@ -48,28 +48,6 @@ if (process.env.DEFAULT_HTTP_TIMEOUT_MS)
48
48
  }
49
49
  }
50
50
 
51
- // disable for now
52
- /*
53
- // report http/https socket state every minute
54
- var socketReportFn = function()
55
- {
56
- setTimeout(function() {
57
-
58
- var http = require("http");
59
- var https = require("https");
60
-
61
- process.log("--- START SOCKET REPORT ---");
62
- process.log("[http]: " + JSON.stringify(http.globalAgent.getCurrentStatus(), null, " "));
63
- process.log("[https]:" + JSON.stringify(https.globalAgent.getCurrentStatus(), null, " "));
64
- process.log("--- END SOCKET REPORT ---");
65
-
66
- socketReportFn();
67
-
68
- }, 60 * 1000);
69
- };
70
- socketReportFn();
71
- */
72
-
73
51
  // root ssl ca's
74
52
  require("ssl-root-cas").inject();
75
53
 
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": "3.2.281",
9
+ "version": "3.2.282",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "git://github.com/gitana/cloudcms-server.git"
@@ -87,7 +87,6 @@
87
87
  "stomp-client": "^0.9.0",
88
88
  "targz": "^1.0.1",
89
89
  "temp": "^0.8.3",
90
- "toobusy-js": "^0.5.1",
91
90
  "uuid": "^3.3.2",
92
91
  "vm2": "^3.8.4",
93
92
  "watch": "^0.13.0",
package/server/index.js CHANGED
@@ -40,10 +40,6 @@ var coreHelpers = require("../duster/helpers/core/index");
40
40
 
41
41
  var helmet = require("helmet");
42
42
 
43
- var toobusy = require("toobusy-js");
44
- toobusy.maxLag(500); // 500 ms lag in event queue, quite high but usable for now
45
- toobusy.interval(250);
46
-
47
43
  var responseTime = require("response-time");
48
44
 
49
45
  // safely checks for the existence of a path
@@ -890,15 +886,6 @@ var startServer = function(config, startServerFinishedFn)
890
886
  });
891
887
  */
892
888
 
893
- // middleware which blocks requests when we're too busy
894
- app.use(function(req, res, next) {
895
- if (toobusy()) {
896
- res.status(503).send("The web application is too busy to serve this request. Please try again.");
897
- } else {
898
- next();
899
- }
900
- });
901
-
902
889
  // add req.id re
903
890
  app.use(function (req, res, next) {
904
891
  requestCounter++;
@@ -1313,21 +1300,6 @@ var configureServer = function(config, app, httpServer, configureServerFinishedF
1313
1300
  console.log("Server.close produced error: " + JSON.stringify(e));
1314
1301
  }
1315
1302
 
1316
- // ask toobusy to shut down as cleanly as we can
1317
- if (cluster.isMaster)
1318
- {
1319
- console.log(" -> Closing toobusy monitor");
1320
- }
1321
-
1322
- try
1323
- {
1324
- toobusy.shutdown();
1325
- }
1326
- catch (e)
1327
- {
1328
- console.log("toobusy.shutdown produced error: " + JSON.stringify(e));
1329
- }
1330
-
1331
1303
  if (cluster.isMaster)
1332
1304
  {
1333
1305
  console.log("");
@@ -30,6 +30,7 @@ var acquireProxyHandler = exports.acquireProxyHandler = function(proxyTarget, pa
30
30
  // is it already in LRU cache?
31
31
  // if so hand it back
32
32
  var _cachedHandler = NAMED_PROXY_HANDLERS_CACHE[name];
33
+ _cachedHandler = null;
33
34
  if (_cachedHandler)
34
35
  {
35
36
  return callback(null, _cachedHandler);
@@ -40,12 +41,15 @@ var acquireProxyHandler = exports.acquireProxyHandler = function(proxyTarget, pa
40
41
 
41
42
  if (err)
42
43
  {
44
+ console.log("Failed to acquire proxy handler: " + name + ", err: ", err);
45
+
43
46
  // failed to acquire lock
44
47
  return callback(err);
45
48
  }
46
49
 
47
50
  // second check to make sure another thread didn't create the handler in the meantime
48
51
  _cachedHandler = NAMED_PROXY_HANDLERS_CACHE[name];
52
+ _cachedHandler = null;
49
53
  if (_cachedHandler)
50
54
  {
51
55
  releaseLockFn();
@@ -53,6 +57,7 @@ var acquireProxyHandler = exports.acquireProxyHandler = function(proxyTarget, pa
53
57
  }
54
58
 
55
59
  // create the proxy handler and cache it into LRU cache
60
+ console.log("Acquiring proxy handler: " + name + ", for target: " + proxyTarget + " and prefix: " + pathPrefix);
56
61
  _cachedHandler = createProxyHandler(proxyTarget, pathPrefix);
57
62
 
58
63
  // store back into LRU cache
@@ -270,78 +275,6 @@ var createProxyHandler = function(proxyTarget, pathPrefix)
270
275
 
271
276
 
272
277
  // cookie domain rewrite?
273
-
274
- // // if we're using auth credentials that are picked up in SSO chain, then we listen for a 401
275
- // // and if we hear it, we automatically invalidate the SSO chain so that the next request
276
- // // will continue to work
277
- // proxyServer.on("proxyRes", function (proxyRes, req, res) {
278
- //
279
- // console.log("proxyRes.1");
280
- //
281
- // if (req.gitana_user)
282
- // {
283
- // var chunks = [];
284
- // // triggers on data receive
285
- // proxyRes.on('data', function(chunk) {
286
- // // add received chunk to chunks array
287
- // chunks.push(chunk);
288
- // });
289
- //
290
- // proxyRes.on("end", function () {
291
- //
292
- // console.log("proxyRes.end, code: " + proxyRes.statusCode);
293
- //
294
- // if (proxyRes.statusCode === 401)
295
- // {
296
- // var text = "" + Buffer.concat(chunks);
297
- // if (text && (text.indexOf("invalid_token") > -1) || (text.indexOf("invalid_grant") > -1))
298
- // {
299
- // var identifier = req.identity_properties.provider_id + "/" + req.identity_properties.user_identifier;
300
- //
301
- // _LOCK([identifier], function(err, releaseLockFn) {
302
- //
303
- // if (err)
304
- // {
305
- // // failed to acquire lock
306
- // console.log("FAILED TO ACQUIRE LOCK", err);
307
- // req.log("FAILED TO ACQUIRE LOCK", err);
308
- // return;
309
- // }
310
- //
311
- // var cleanup = function (full)
312
- // {
313
- // delete Gitana.APPS[req.identity_properties.token];
314
- // delete Gitana.PLATFORM_CACHE[req.identity_properties.token];
315
- //
316
- // if (full) {
317
- // auth.removeUserCacheEntry(identifier);
318
- // }
319
- // };
320
- //
321
- // // null out the access token
322
- // // this will force the refresh token to be used to get a new one on the next request
323
- // req.gitana_user.getDriver().http.refresh(function (err) {
324
- //
325
- // if (err) {
326
- // cleanup(true);
327
- // req.log("Invalidated auth state for gitana user: " + req.identity_properties.token);
328
- // releaseLockFn();
329
- // return;
330
- // }
331
- //
332
- // req.gitana_user.getDriver().reloadAuthInfo(function () {
333
- // cleanup(true);
334
- // req.log("Refreshed token for gitana user: " + req.identity_properties.token);
335
- // releaseLockFn();
336
- // });
337
- // });
338
- // });
339
- // }
340
- //
341
- // }
342
- // });
343
- // }
344
- // });
345
278
 
346
279
  return proxyRequestHandler;
347
280
  };