fix: only save state after successful DNS update
This commit is contained in:
parent
c4c80e98af
commit
89bd1dba11
1 changed files with 8 additions and 2 deletions
10
index.js
10
index.js
|
|
@ -192,8 +192,14 @@ async function main() {
|
||||||
].join('\n');
|
].join('\n');
|
||||||
|
|
||||||
await sendWhatsApp(message);
|
await sendWhatsApp(message);
|
||||||
writeState(currentIp);
|
|
||||||
log(`State saved: ${currentIp}`);
|
if (failCount === 0) {
|
||||||
|
writeState(currentIp);
|
||||||
|
log(`State saved: ${currentIp}`);
|
||||||
|
} else {
|
||||||
|
log(`State NOT saved: ${failCount} DNS update(s) failed. Will retry on next run.`);
|
||||||
|
}
|
||||||
|
|
||||||
log('Done.');
|
log('Done.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue