Tune batch request params

This commit is contained in:
Tornado Contrib 2024-11-02 23:30:53 +00:00
parent f6e676fd0b
commit e75dddfbf7
Signed by: tornadocontrib
GPG Key ID: 60B4DF1A076C64B1
5 changed files with 17 additions and 17 deletions

8
dist/index.js vendored

@ -181,7 +181,7 @@ class BatchBlockService {
} }
createBatchRequest(batchArray) { createBatchRequest(batchArray) {
return batchArray.map(async (blocks, index) => { return batchArray.map(async (blocks, index) => {
await sleep(20 * index); await sleep(40 * index);
return (async () => { return (async () => {
let retries = 0; let retries = 0;
let err; let err;
@ -259,7 +259,7 @@ class BatchTransactionService {
} }
createBatchRequest(batchArray, receipt) { createBatchRequest(batchArray, receipt) {
return batchArray.map(async (txs, index) => { return batchArray.map(async (txs, index) => {
await sleep(20 * index); await sleep(40 * index);
return (async () => { return (async () => {
let retries = 0; let retries = 0;
let err; let err;
@ -329,7 +329,7 @@ class BatchEventsService {
contract, contract,
onProgress, onProgress,
concurrencySize = 10, concurrencySize = 10,
blocksPerRequest = 2e3, blocksPerRequest = 5e3,
shouldRetry = true, shouldRetry = true,
retryMax = 5, retryMax = 5,
retryOn = 500 retryOn = 500
@ -363,7 +363,7 @@ class BatchEventsService {
} }
createBatchRequest(batchArray) { createBatchRequest(batchArray) {
return batchArray.map(async (event, index) => { return batchArray.map(async (event, index) => {
await sleep(20 * index); await sleep(10 * index);
return this.getPastEvents(event); return this.getPastEvents(event);
}); });
} }

8
dist/index.mjs vendored

@ -160,7 +160,7 @@ class BatchBlockService {
} }
createBatchRequest(batchArray) { createBatchRequest(batchArray) {
return batchArray.map(async (blocks, index) => { return batchArray.map(async (blocks, index) => {
await sleep(20 * index); await sleep(40 * index);
return (async () => { return (async () => {
let retries = 0; let retries = 0;
let err; let err;
@ -238,7 +238,7 @@ class BatchTransactionService {
} }
createBatchRequest(batchArray, receipt) { createBatchRequest(batchArray, receipt) {
return batchArray.map(async (txs, index) => { return batchArray.map(async (txs, index) => {
await sleep(20 * index); await sleep(40 * index);
return (async () => { return (async () => {
let retries = 0; let retries = 0;
let err; let err;
@ -308,7 +308,7 @@ class BatchEventsService {
contract, contract,
onProgress, onProgress,
concurrencySize = 10, concurrencySize = 10,
blocksPerRequest = 2e3, blocksPerRequest = 5e3,
shouldRetry = true, shouldRetry = true,
retryMax = 5, retryMax = 5,
retryOn = 500 retryOn = 500
@ -342,7 +342,7 @@ class BatchEventsService {
} }
createBatchRequest(batchArray) { createBatchRequest(batchArray) {
return batchArray.map(async (event, index) => { return batchArray.map(async (event, index) => {
await sleep(20 * index); await sleep(10 * index);
return this.getPastEvents(event); return this.getPastEvents(event);
}); });
} }

8
dist/tornado.umd.js vendored

@ -58586,7 +58586,7 @@ class BatchBlockService {
} }
createBatchRequest(batchArray) { createBatchRequest(batchArray) {
return batchArray.map(async (blocks, index) => { return batchArray.map(async (blocks, index) => {
await (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(20 * index); await (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(40 * index);
return (async () => { return (async () => {
let retries = 0; let retries = 0;
let err; let err;
@ -58664,7 +58664,7 @@ class BatchTransactionService {
} }
createBatchRequest(batchArray, receipt) { createBatchRequest(batchArray, receipt) {
return batchArray.map(async (txs, index) => { return batchArray.map(async (txs, index) => {
await (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(20 * index); await (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(40 * index);
return (async () => { return (async () => {
let retries = 0; let retries = 0;
let err; let err;
@ -58734,7 +58734,7 @@ class BatchEventsService {
contract, contract,
onProgress, onProgress,
concurrencySize = 10, concurrencySize = 10,
blocksPerRequest = 2e3, blocksPerRequest = 5e3,
shouldRetry = true, shouldRetry = true,
retryMax = 5, retryMax = 5,
retryOn = 500 retryOn = 500
@ -58768,7 +58768,7 @@ class BatchEventsService {
} }
createBatchRequest(batchArray) { createBatchRequest(batchArray) {
return batchArray.map(async (event, index) => { return batchArray.map(async (event, index) => {
await (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(20 * index); await (0,_utils__WEBPACK_IMPORTED_MODULE_0__/* .sleep */ .yy)(10 * index);
return this.getPastEvents(event); return this.getPastEvents(event);
}); });
} }

File diff suppressed because one or more lines are too long

@ -74,7 +74,7 @@ export class BatchBlockService {
createBatchRequest(batchArray: BlockTag[][]): Promise<Block[]>[] { createBatchRequest(batchArray: BlockTag[][]): Promise<Block[]>[] {
return batchArray.map(async (blocks: BlockTag[], index: number) => { return batchArray.map(async (blocks: BlockTag[], index: number) => {
// send batch requests on milliseconds to avoid including them on a single batch request // send batch requests on milliseconds to avoid including them on a single batch request
await sleep(20 * index); await sleep(40 * index);
return (async () => { return (async () => {
let retries = 0; let retries = 0;
@ -178,7 +178,7 @@ export class BatchTransactionService {
receipt?: boolean, receipt?: boolean,
): Promise<TransactionResponse[] | TransactionReceipt[]>[] { ): Promise<TransactionResponse[] | TransactionReceipt[]>[] {
return batchArray.map(async (txs: string[], index: number) => { return batchArray.map(async (txs: string[], index: number) => {
await sleep(20 * index); await sleep(40 * index);
return (async () => { return (async () => {
let retries = 0; let retries = 0;
@ -306,7 +306,7 @@ export class BatchEventsService {
contract, contract,
onProgress, onProgress,
concurrencySize = 10, concurrencySize = 10,
blocksPerRequest = 2000, blocksPerRequest = 5000,
shouldRetry = true, shouldRetry = true,
retryMax = 5, retryMax = 5,
retryOn = 500, retryOn = 500,
@ -351,7 +351,7 @@ export class BatchEventsService {
createBatchRequest(batchArray: EventInput[]): Promise<EventLog[]>[] { createBatchRequest(batchArray: EventInput[]): Promise<EventLog[]>[] {
return batchArray.map(async (event: EventInput, index: number) => { return batchArray.map(async (event: EventInput, index: number) => {
await sleep(20 * index); await sleep(10 * index);
return this.getPastEvents(event); return this.getPastEvents(event);
}); });