fix interval

master
adb 4 years ago
parent 2a9f5873ff
commit 1eb45bbe8c

@ -18,14 +18,15 @@ export class DynDnsBot{
}); });
} }
setInterval(seconds = this.config.updateInterval, random = this.config.randomInterval){ setInterval(seconds = this.config.updateInterval, random = this.config.randomInterval){
this.interval = setInterval(random let handler = (callback) => random
?setTimeout(this.update, Math.random()*seconds*1000) ?()=>setTimeout(callback, Math.random()*seconds*1000)
:this.update, :callback;
seconds*1000); this.interval = setInterval(handler(this.update), seconds*1000);
this.update();
} }
async getIp(){ async getIp(){
return await rest.get(this.config.ipApi).then(newIp => { return await rest.get(this.config.ipApi).then(res => {
return newIp; return JSON.parse(res.text);
}).catch(console.error); }).catch(console.error);
} }
} }
Loading…
Cancel
Save