1import { sleep } from '../../sharedF/sleepF.mts'3const isEnotfound = (err: any): boolean => err?.code === 'ENOTFOUND' || err?.cause?.code === 'ENOTFOUND'5export const withTransientDnsRetry = async <T,>(fn: () => Promise<T>, {attempts = 12, intervalMs = 8000} = {}): Promise<T> => {6 for (let i = 0; i < attempts; i++) {7 try {8 return await fn()9 } catch (err: any) {10 if (!isEnotfound(err) || i === attempts - 1) throw err11 console.log(`ENOTFOUND (transient, external-dns may still be propagating) — retry ${i + 1}/${attempts - 1}`)13 }14 }15 throw new Error('unreachable')16}