improve rpc rate-limit conditions
This commit is contained in:
parent
aef16eda5f
commit
2b61afbafe
@ -280,8 +280,8 @@ class EventService {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (shouldRetry) {
|
if (shouldRetry) {
|
||||||
i = i + 1
|
i = i + 1
|
||||||
// maximum 10 second buffer for rate-limiting
|
// maximum 5 second buffer for rate-limiting
|
||||||
await sleep(2000 * i)
|
await sleep(1000 * i)
|
||||||
|
|
||||||
events = await this.getEventsPartFromRpc(
|
events = await this.getEventsPartFromRpc(
|
||||||
{
|
{
|
||||||
@ -317,6 +317,7 @@ class EventService {
|
|||||||
(e, i) =>
|
(e, i) =>
|
||||||
new Promise(async (resolve) => {
|
new Promise(async (resolve) => {
|
||||||
try {
|
try {
|
||||||
|
sleep(20 * i)
|
||||||
const { events } = await this.getEventsPartFromRpc({ ...e }, true)
|
const { events } = await this.getEventsPartFromRpc({ ...e }, true)
|
||||||
resolve(events)
|
resolve(events)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -369,7 +370,6 @@ class EventService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
await this.updateEventProgress(progressIndex / batchCount, type)
|
await this.updateEventProgress(progressIndex / batchCount, type)
|
||||||
await sleep(200)
|
|
||||||
}
|
}
|
||||||
events = flattenNArray(events)
|
events = flattenNArray(events)
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class RelayerRegister {
|
|||||||
resolve(registeredEventsPart)
|
resolve(registeredEventsPart)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (shouldRetry) {
|
if (shouldRetry) {
|
||||||
sleep(1000)
|
sleep(500)
|
||||||
|
|
||||||
const events = this.fetchEvents({ fromBlock, toBlock })
|
const events = this.fetchEvents({ fromBlock, toBlock })
|
||||||
|
|
||||||
@ -61,8 +61,7 @@ class RelayerRegister {
|
|||||||
const promises = new Array(chunkCount).fill('').map(
|
const promises = new Array(chunkCount).fill('').map(
|
||||||
(_, i) =>
|
(_, i) =>
|
||||||
new Promise((resolve) => {
|
new Promise((resolve) => {
|
||||||
sleep(300)
|
sleep(20 * i)
|
||||||
|
|
||||||
const batch = this.fetchEvents(
|
const batch = this.fetchEvents(
|
||||||
{
|
{
|
||||||
fromBlock: i * blockDenom + fromBlock,
|
fromBlock: i * blockDenom + fromBlock,
|
||||||
|
Loading…
Reference in New Issue
Block a user