Skip to content

Commit

Permalink
fix(vonage): fix too many requests when using sandbox (#176)
Browse files Browse the repository at this point in the history
* fix(vonage): fix too many requests when using sandbox

* pr comment

* limit to one req per sec when using vonage sandbox
  • Loading branch information
laurentlp committed Oct 12, 2021
1 parent 95ef289 commit 59982f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/server/src/channels/vonage/senders/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export class VonageCommonSender extends CommonSender {
}

context.logger.error(undefined, `${errBody.title}: ${errBody.detail} ${reasons}${errBody.type || ''}`)
} else if ((<any>err).statusCode === '429') {
// eslint-disable-next-line eqeqeq
} else if ((<any>err).statusCode == '429') {
context.logger.error(undefined, 'HTTPError (429): Too Many Requests')
} else {
context.logger.error(undefined, 'UnknownError', err)
Expand Down
4 changes: 3 additions & 1 deletion packages/server/src/instances/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,11 @@ export class InstanceService extends Service {
return
}

const promises = []
for (const convmap of convmaps) {
void this.sendMessageToInstance(message, source, client!.providerId, convmap)
promises.push(this.sendMessageToInstance(message, source, client!.providerId, convmap))
}
await Promise.all(promises)
}

private async sendMessageToInstance(
Expand Down

0 comments on commit 59982f2

Please sign in to comment.