researchSync: Fixed crash when master contact is lost

This commit is contained in:
Danielv123 committed 2018-04-14 11:17:38 +02:00
1 parent 1d0d9765bd
commit 6bbd6b8717
1 file changed
+5 -3
+5 -3
View File
@@ -11,8 +11,8 @@ class ResearchSync {
this.research = {}; this.research = {};
setInterval(() => { setInterval(() => {
this.doSync();
this.pollResearch(); this.pollResearch();
setTimeout(this.doSync, 2000);
}, extras.researchSyncPollInterval || 30000); }, extras.researchSyncPollInterval || 30000);
} }
@@ -25,8 +25,10 @@ class ResearchSync {
needle.post(this.config.masterIP + ':' + this.config.masterPort + '/api/getSlavesMeta', { needle.post(this.config.masterIP + ':' + this.config.masterPort + '/api/getSlavesMeta', {
password: this.config.clientPassword, password: this.config.clientPassword,
}, (err, resp, body) => { }, (err, resp, body) => {
if (err) throw err; if (err){
this.messageInterface("Unable to post JSON master/api/getSlavesMeta, master might be unaccessible";
return false;
}
if (resp.statusCode != 200){ if (resp.statusCode != 200){
this.messageInterface("got error when calling getSlaveMeta", resp.statusCode, resp.body); this.messageInterface("got error when calling getSlaveMeta", resp.statusCode, resp.body);
return; return;