async function waitForTxt(domain, txt, tryCount = 0) { if (tryCount > 10) return false; return new Promise((resolve) => { setTimeout(() => { dns.resolveTxt(domain, (err, [res]) => { Log.debug('got txtrecord', res, tryCount); if (err || !res || txt !== res[0]) { return waitForTxt(domain, txt, tryCount + 1).then(resolve); } return resolve(); }); }, tryCount * 2000); }); }