Skip to content

Commit d096130

Browse files
authored
Merge pull request #234 from apigee-internal/b133195226
Reload crashes EdgeMicro 2.5.35
2 parents 8fdd05e + 56b7131 commit d096130

File tree

4 files changed

+18
-12
lines changed

4 files changed

+18
-12
lines changed

cli/lib/gateway.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const defaultPollInterval = 600;
1515
const uuid = require('uuid/v1');
1616
const debug = require('debug')('microgateway');
1717
const jsdiff = require('diff');
18+
const _ = require('lodash');
1819

1920
const Gateway = function() {};
2021

@@ -326,19 +327,22 @@ function hasConfigChanged(oldConfig, newConfig) {
326327
//do not compare uid
327328
delete oldConfig['uid'];
328329

329-
var diff = jsdiff.diffWords(JSON.stringify(oldConfig), JSON.stringify(newConfig));
330-
if (diff.length == 1) {
330+
331+
if (_.isEqual(oldConfig, newConfig)) {
331332
debug("no changes detected");
332333
return false;
333334
} else {
334-
diff.forEach(function(part) {
335-
if (part.added)
336-
debug("Added->" + part.value);
337-
else if (part.removed)
338-
debug("Removed->" + part.value);
339-
else
340-
debug("Unchanged->" + part.value);
341-
});
335+
if (debug.enabled) {
336+
var diff = jsdiff.diffWords(JSON.stringify(oldConfig), JSON.stringify(newConfig));
337+
diff.forEach(function(part) {
338+
if (part.added)
339+
debug("Added->" + part.value);
340+
else if (part.removed)
341+
debug("Removed->" + part.value);
342+
else
343+
debug("Unchanged->" + part.value);
344+
});
345+
}
342346
return true;
343347
}
344348
}

cli/lib/reload-cluster.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ var ReloadCluster = (file, opt) => {
254254
*/
255255
self.reload = function (cb) {
256256
if (!cluster.isMaster) return;
257+
//clear the cache before terminating the process
258+
cache.clear(function(){});
257259
respawnerTimers.clear();
258260

259261
function allReady(cb) {

npm-shrinkwrap.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "edgemicro",
3-
"version": "2.5.35",
3+
"version": "2.5.36",
44
"description": "Apigee Edge Microgateway",
55
"main": "index.js",
66
"license": "Apache-2.0",

0 commit comments

Comments
 (0)