Skip to content

Commit

Permalink
feat(api): import got only once
Browse files Browse the repository at this point in the history
  • Loading branch information
stfsy committed Oct 11, 2022
1 parent b7d2cb7 commit 84ad151
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions lib/paddle/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,20 @@ module.exports = class {
}

async init() {
this._got = (await import('got')).default.extend({
prefixUrl: this._baseUrl,
method: 'POST',
retry: {
limit: 0
},
timeout: {
connect: 5_000,
send: 20_000,
},
throwHttpErrors: false,
})
if (!this._got) {
this._got = (await import('got')).default.extend({
prefixUrl: this._baseUrl,
method: 'POST',
retry: {
limit: 0
},
timeout: {
connect: 5_000,
send: 20_000,
},
throwHttpErrors: false,
})
}
}

/**
Expand Down

0 comments on commit 84ad151

Please sign in to comment.