Skip to content

Commit

Permalink
More attempts and more time
Browse files Browse the repository at this point in the history
  • Loading branch information
cmgustavo committed Apr 16, 2020
1 parent 2607ef4 commit 6e12e08
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/providers/gift-card/gift-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,9 @@ export class GiftCardProvider extends InvoiceProvider {

const cardOrder = await promise(params).catch(async err => {
this.logger.error('BitPay Create Invoice: ERROR', JSON.stringify(err));
if (attempt <= 3 && err.status == 403) {
attempt++;
await new Promise(resolve => setTimeout(resolve, 3000));
return this.createBitpayInvoice(data, attempt);
if (attempt <= 5 && err.status == 403) {
await new Promise(resolve => setTimeout(resolve, 3000 * attempt));
return this.createBitpayInvoice(data, ++attempt);
} else throw err;
});
this.logger.info('BitPay Create Invoice: SUCCESS');
Expand Down

0 comments on commit 6e12e08

Please sign in to comment.