Browse Source

Reduce the number of retries on cert creation (#664)

Retrying multiple times on cert creation doesn't usually help but
makes the user wait for a longer time for nothing. Usually there
is either a configuration error that must be solved or the DNS
change hasn't propagated yet, which will usually take longer than
the retry window.
master
Olli Vanhoja 8 years ago
committed by Leo Lamprecht
parent
commit
5080520616
  1. 37
      lib/index.js

37
lib/index.js

@ -756,31 +756,34 @@ module.exports = class Now extends EventEmitter {
} }
return body return body
}, },
{ retries: 5, minTimeout: 30000, maxTimeout: 90000 } { retries: 3, minTimeout: 30000, maxTimeout: 90000 }
) )
} }
deleteCert(domain) { deleteCert(domain) {
return this.retry(async (bail, attempt) => { return this.retry(
if (this._debug) { async (bail, attempt) => {
console.time(`> [debug] /now/certs #${attempt}`) if (this._debug) {
} console.time(`> [debug] /now/certs #${attempt}`)
}
const res = await this._fetch(`/now/certs/${domain}`, { const res = await this._fetch(`/now/certs/${domain}`, {
method: 'DELETE' method: 'DELETE'
}) })
if (res.status !== 200) { if (res.status !== 200) {
const err = new Error(res.body.error.message) const err = new Error(res.body.error.message)
err.userError = false err.userError = false
if (res.status === 400 || res.status === 404) { if (res.status === 400 || res.status === 404) {
return bail(err) return bail(err)
} }
throw err throw err
} }
}) },
{ retries: 3 }
)
} }
async remove(deploymentId, { hard }) { async remove(deploymentId, { hard }) {

Loading…
Cancel
Save