Retry auto-install of modules that fail

- introduces autoInstallModulesRetry - default 30000
 - backs off interval if repeated failures
 - fixes notification to the editor of an auto-reinstall
This commit is contained in:
Nick O'Leary
2017-07-08 17:27:45 +01:00
parent 3a2f56cb95
commit f9769a73fe
11 changed files with 86 additions and 32 deletions

View File

@@ -22,7 +22,6 @@ var sinon = require('sinon');
var when = require('when');
var nodes = require("../../../red/api/nodes");
var comms = require("../../../red/api/comms");
var locales = require("../../../red/api/locales");
describe("nodes api", function() {
@@ -35,6 +34,9 @@ describe("nodes api", function() {
info: function(){},
warn: function(){}
}
runtime.events = {
emit: function(){}
}
nodes.init(runtime);
}
@@ -49,15 +51,11 @@ describe("nodes api", function() {
app.put(/\/nodes\/((@[^\/]+\/)?[^\/]+)$/,nodes.putModule);
app.put(/\/nodes\/((@[^\/]+\/)?[^\/]+)\/([^\/]+)$/,nodes.putSet);
app.delete("/nodes/:id",nodes.delete);
sinon.stub(comms,"publish");
sinon.stub(locales,"determineLangFromHeaders", function() {
return "en-US";
});
});
after(function() {
comms.publish.restore();
});
describe('get nodes', function() {
it('returns node list', function(done) {

View File

@@ -141,7 +141,7 @@ describe("runtime", function() {
{ module:"node-red",enabled:true,loaded:false,types:["typeC","typeD"]} // missing
].filter(cb);
});
var serverInstallModule = sinon.stub(redNodes,"installModule",function(name) { return when.resolve();});
var serverInstallModule = sinon.stub(redNodes,"installModule",function(name) { return when.resolve({nodes:[]});});
runtime.init({testSettings: true, autoInstallModules:true, httpAdminRoot:"/", load:function() { return when.resolve();}});
sinon.stub(console,"log");
runtime.start().then(function() {