Skip to content

Commit

Permalink
fix: add rate limiter on makeRequestBC
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaccoSordo committed Sep 2, 2024
1 parent 1059a36 commit 752f1a2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/beacon-dapp/src/dapp-client/DAppClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2518,6 +2518,14 @@ export class DAppClient extends Client {
return
}

if (await this.addRequestAndCheckIfRateLimited()) {
this.events
.emit(BeaconEvent.LOCAL_RATE_LIMIT_REACHED)
.catch((emitError) => console.warn(emitError))

throw new Error('rate limit reached')
}

const id = await generateGUID()

this.multiTabChannel.postMessage({
Expand Down

0 comments on commit 752f1a2

Please sign in to comment.