Skip to content

Commit 7ea4126

Browse files
committed
Move out wait time variable
1 parent 746f8a7 commit 7ea4126

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/providers/walletconnectNotify.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const AUTH_HEADER = {
1818
const MAX_ACCOUNTS_PER_REQUEST = 500;
1919
const PER_SECOND_RATE_LIMIT = 2;
2020
const WAIT_ERROR_MARGIN = 0.25;
21+
const WAIT_TIME = 1 / PER_SECOND_RATE_LIMIT + WAIT_ERROR_MARGIN;
2122

2223
// Rate limiting logic:
2324
async function wait(seconds: number) {
@@ -81,8 +82,8 @@ async function queueNotificationsToSend(notification, accounts: string[]) {
8182
notification,
8283
accounts.slice(i, i + MAX_ACCOUNTS_PER_REQUEST)
8384
);
84-
const waitTime = 1 / PER_SECOND_RATE_LIMIT + WAIT_ERROR_MARGIN;
85-
await wait(waitTime);
85+
86+
await wait(WAIT_TIME);
8687
}
8788
}
8889

0 commit comments

Comments
 (0)