Skip to content

Commit

Permalink
Limit amount of hotspot create retries.
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewcarlreetz committed Apr 11, 2024
1 parent 549db22 commit 81618f7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/onboarding/src/MobileHotspotOnboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,10 @@ export default class MobileHotspotOnboarding {
this.setProgressToStep('fetch_create')

let txIds: string[] = []
let tries = 0

while (!txIds.length) {
while (!txIds.length && tries < 12) {
tries++
try {
const createTxns = await this._onboardingClient.createHotspot({
transaction,
Expand All @@ -315,6 +317,14 @@ export default class MobileHotspotOnboarding {
} catch (e) {
this.writeError(e)
}

if (!txIds.length) {
await sleep(5000) // wait 5 seconds before trying again
}
}

if (!txIds.length) {
throw new Error('Failed to create hotspot')
}

return txIds
Expand Down

0 comments on commit 81618f7

Please sign in to comment.