porkbun: it is really slow

This commit is contained in:
Girish Ramakrishnan
2024-12-16 09:46:38 +01:00
parent 3d8ffcd0f7
commit 1d0f3a08f4
3 changed files with 9 additions and 9 deletions

View File

@@ -154,7 +154,7 @@ async function upsertDnsRecords(subdomain, domain, type, values) {
assert.strictEqual(typeof type, 'string');
assert(Array.isArray(values));
debug(`upsertDnsRecord: location ${subdomain} on domain ${domain} of type ${type} with values ${JSON.stringify(values)}`);
debug(`upsertDnsRecords: subdomain:${subdomain} domain:${domain} type:${type} values:${JSON.stringify(values)}`);
const domainObject = await domains.get(domain);
await api(domainObject.provider).upsert(domainObject, subdomain, type, values);
@@ -166,7 +166,7 @@ async function removeDnsRecords(subdomain, domain, type, values) {
assert.strictEqual(typeof type, 'string');
assert(Array.isArray(values));
debug('removeDnsRecords: %s on %s type %s values', subdomain, domain, type, values);
debug(`removeDnsRecords: subdomain:${subdomain} domain:${domain} type:${type} values:${JSON.stringify(values)}`);
const domainObject = await domains.get(domain);
const [error] = await safe(api(domainObject.provider).del(domainObject, subdomain, type, values));

View File

@@ -44,7 +44,7 @@ async function getDnsRecords(domainConfig, zoneName, name, type) {
assert.strictEqual(typeof name, 'string');
assert.strictEqual(typeof type, 'string');
debug(`get: ${name} in zone ${zoneName} of type ${type}`);
debug(`get: ${name} zone:${zoneName} type:${type}`);
const data = {
secretapikey: domainConfig.secretapikey,
@@ -100,7 +100,7 @@ async function upsert(domainObject, location, type, values) {
zoneName = domainObject.zoneName,
name = dns.getName(domainObject, location, type) || '';
debug(`upsert: ${name} in zone ${zoneName} of type ${type} with values ${JSON.stringify(values)}`);
debug(`upsert: ${name} zone:${zoneName} type:${type} values:${JSON.stringify(values)}`);
await delDnsRecords(domainConfig, zoneName, name, type);
@@ -135,7 +135,7 @@ async function upsert(domainObject, location, type, values) {
debug(`upsert: created record with id ${response.body.id}`);
await timers.setTimeout(1500); // see rate limit note at top of file
await timers.setTimeout(5000); // see rate limit note at top of file
}
}
@@ -162,7 +162,7 @@ async function del(domainObject, location, type, values) {
zoneName = domainObject.zoneName,
name = dns.getName(domainObject, location, type) || '';
debug(`del: ${name} in zone ${zoneName} of type ${type} with values ${JSON.stringify(values)}`);
debug(`del: ${name} zone ${zoneName} of type ${type} with values ${JSON.stringify(values)}`);
const data = {
secretapikey: domainConfig.secretapikey,
@@ -185,7 +185,7 @@ async function del(domainObject, location, type, values) {
if (response.statusCode !== 200) throw new BoxError(BoxError.EXTERNAL_ERROR, formatError(response));
if (response.body.status !== 'SUCCESS') throw new BoxError(BoxError.EXTERNAL_ERROR, `Invalid status in response: ${JSON.stringify(response.body)}`);
await timers.setTimeout(1500); // see rate limit note at top of file
await timers.setTimeout(5000); // see rate limit note at top of file
}
}

View File

@@ -684,7 +684,7 @@ async function upsertDnsRecords(domain, mailFqdn) {
assert.strictEqual(typeof domain, 'string');
assert.strictEqual(typeof mailFqdn, 'string');
debug(`upsertDnsRecords: updating mail dns records of domain ${domain} and mail fqdn ${mailFqdn}`);
debug(`upsertDnsRecords: updating mail dns records domain:${domain} mailFqdn:${mailFqdn}`);
const mailDomain = await getDomain(domain);
if (!mailDomain) throw new BoxError(BoxError.NOT_FOUND, 'mail domain not found');
@@ -706,7 +706,7 @@ async function upsertDnsRecords(domain, mailFqdn) {
const dmarcRecords = await dns.getDnsRecords('_dmarc', domain, 'TXT'); // only update dmarc if absent. this allows user to set email for reporting
if (dmarcRecords.length === 0) records.push({ subdomain: '_dmarc', domain, type: 'TXT', values: [ '"v=DMARC1; p=reject; pct=100"' ] });
debug(`upsertDnsRecords: will update ${domain} with ${JSON.stringify(records)}`);
debug(`upsertDnsRecords: updating ${domain} with ${records.length} records: ${JSON.stringify(records)}`);
for (const record of records) {
await dns.upsertDnsRecords(record.subdomain, record.domain, record.type, record.values);