promise-retry: rename api to log
This commit is contained in:
+5
-5
@@ -250,7 +250,7 @@ async function registerLocations(locations, options, progressCallback) {
|
||||
for (const location of locations) {
|
||||
progressCallback({ message: `Registering location ${fqdn(location.subdomain, location.domain)}` });
|
||||
|
||||
await promiseRetry({ times: 200, interval: 5000, debug: log, retry: (error) => error.retryable }, async function () {
|
||||
await promiseRetry({ times: 200, interval: 5000, log, retry: (error) => error.retryable }, async function () {
|
||||
// cname records cannot co-exist with other records
|
||||
const [getError, values] = await safe(getDnsRecords(location.subdomain, location.domain, 'CNAME'));
|
||||
if (!getError && values.length === 1) {
|
||||
@@ -263,14 +263,14 @@ async function registerLocations(locations, options, progressCallback) {
|
||||
await registerLocation(location, options, 'A', ipv4);
|
||||
} else {
|
||||
const [aError, aValues] = await safe(getDnsRecords(location.subdomain, location.domain, 'A'));
|
||||
if (!aError && aValues.length) await safe(removeDnsRecords(location.subdomain, location.domain, 'A', aValues), { debug: log });
|
||||
if (!aError && aValues.length) await safe(removeDnsRecords(location.subdomain, location.domain, 'A', aValues), { log });
|
||||
}
|
||||
|
||||
if (ipv6) {
|
||||
await registerLocation(location, options, 'AAAA', ipv6);
|
||||
} else {
|
||||
const [aaaaError, aaaaValues] = await safe(getDnsRecords(location.subdomain, location.domain, 'AAAA'));
|
||||
if (!aaaaError && aaaaValues.length) await safe(removeDnsRecords(location.subdomain, location.domain, 'AAAA', aaaaValues), { debug: log });
|
||||
if (!aaaaError && aaaaValues.length) await safe(removeDnsRecords(location.subdomain, location.domain, 'AAAA', aaaaValues), { log });
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -300,7 +300,7 @@ async function unregisterLocations(locations, progressCallback) {
|
||||
for (const location of locations) {
|
||||
progressCallback({ message: `Unregistering location: ${location.subdomain ? (location.subdomain + '.') : ''}${location.domain}` });
|
||||
|
||||
await promiseRetry({ times: 30, interval: 5000, debug: log, retry: (error) => error.retryable }, async function () {
|
||||
await promiseRetry({ times: 30, interval: 5000, log, retry: (error) => error.retryable }, async function () {
|
||||
if (ipv4) await unregisterLocation(location, 'A', ipv4);
|
||||
if (ipv6) await unregisterLocation(location, 'AAAA', ipv6);
|
||||
});
|
||||
@@ -364,7 +364,7 @@ async function startSyncDnsRecords(options) {
|
||||
assert.strictEqual(typeof options, 'object');
|
||||
|
||||
const taskId = await tasks.add(tasks.TASK_SYNC_DNS_RECORDS, [ options ]);
|
||||
safe(tasks.startTask(taskId, {}), { debug: log }); // background
|
||||
safe(tasks.startTask(taskId, {}), { log }); // background
|
||||
return taskId;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user