Skip to content

Commit

Permalink
added the functionality to introduce different timeout value for Web3… (
Browse files Browse the repository at this point in the history
#6336)

* added the functionality to introduce different timeout value for Web3BatchRequest

* update the pr details to changelog

---------

Co-authored-by: Junaid <86780488+jdevcs@users.noreply.github.com>
  • Loading branch information
shubhamshd and jdevcs committed Aug 17, 2023
1 parent 7a38fee commit d41a49e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/web3-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,8 @@ Documentation:
### Fixed

- Fixed rpc errors not being sent as an inner error when using the `send` method on request manager (#6300).

### Added

- To fix issue #6190, added the functionality to introduce different timeout value for Web3. (#6336)

6 changes: 4 additions & 2 deletions packages/web3-core/src/web3_batch_request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ export class Web3BatchRequest {
}

// eslint-disable-next-line class-methods-use-this
public async execute(): Promise<JsonRpcBatchResponse<unknown, unknown>> {
public async execute(options?: {
timeout?: number;
}): Promise<JsonRpcBatchResponse<unknown, unknown>> {
if (this.requests.length === 0) {
return Promise.resolve([]);
}

const request = new Web3DeferredPromise<JsonRpcBatchResponse<unknown, unknown>>({
timeout: DEFAULT_BATCH_REQUEST_TIMEOUT,
timeout: options?.timeout ?? DEFAULT_BATCH_REQUEST_TIMEOUT,
eagerStart: true,
timeoutMessage: 'Batch request timeout',
});
Expand Down
4 changes: 4 additions & 0 deletions packages/web3/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,7 @@ Documentation:
- Added minimum support of web3.extend function

## [Unreleased]

### Added

- To fix issue #6190, added the functionality to introduce different timeout value for Web3. (#6336)

0 comments on commit d41a49e

Please sign in to comment.