diff --git a/build/src/src/client.js b/build/src/src/client.js index a8d52b08..e7df389a 100644 --- a/build/src/src/client.js +++ b/build/src/src/client.js @@ -72,15 +72,18 @@ async function start() { // Watch for IP changes, if so update the IP. On error, asume the IP changed. let _ip = ''; - setInterval(() => { - if (!db.get('staticIp').value()) { - dyndnsClient.getPublicIp().then((ip) => { + setInterval(async () => { + try { + if (!db.get('staticIp').value()) { + const ip = await dyndnsClient.getPublicIp(); if (!ip || ip !== _ip) { dyndnsClient.updateIp(); _ip = ip; } if (ip) db.set('ip', ip).write(); - }); + } + } catch (e) { + logs.error(`Error on dyndns interval: ${e.stack || e.message}`); } }, publicIpCheckInterval); diff --git a/build/src/src/dyndnsClient/checkPublicIp.js b/build/src/src/dyndnsClient/getPublicIp.js similarity index 100% rename from build/src/src/dyndnsClient/checkPublicIp.js rename to build/src/src/dyndnsClient/getPublicIp.js diff --git a/build/src/src/dyndnsClient/index.js b/build/src/src/dyndnsClient/index.js index acd2741d..30dcd3e1 100644 --- a/build/src/src/dyndnsClient/index.js +++ b/build/src/src/dyndnsClient/index.js @@ -1,10 +1,10 @@ const updateIp = require('./updateIp'); const getKeys = require('./getKeys'); -const checkPublicIp = require('./checkPublicIp'); +const getPublicIp = require('./getPublicIp'); module.exports = { updateIp, getKeys, - checkPublicIp, + getPublicIp, };