Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Use setRequestManager instead of setProvider for adding data listener once only #232

Merged
merged 4 commits into from
Mar 4, 2020

Conversation

jimni1222
Copy link
Contributor

Proposed changes

This PR includes the implementation of the setRequestManager function to prevent the addition of multiple data listeners.

This bug is caused by calling the setProvider function for each package when an instance is created.
Calling setProvider for each package adds a data listener to each provider internally.

Old Behaviour

  1. call setProvider.
  2. create RequestManager and register data listener.
  3. call setProvider on all children's.
  4. create RequestManager and register data listener for each child package.

New Behaviour

  1. call setProvider.
  2. create RequestManager and register data listener.
  3. call setRequestManager on all children's.

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

close #230

Further comments

This PR reflected the changes in web3/web3.js#3156
PR.
The changes in above PR are included at other PR, but the other PR has many other changes.
So this PR reflected only the changes in web3/web3.js#3156

Also i included web3/web3.js@26a8775 to change Contract instance's provider when caver.klay.setProvider is called.

After this PR is merged, caver-js v1.4.0-rc.1 will be published.

@jimni1222 jimni1222 requested a review from kjhman21 as a code owner March 4, 2020 02:47
@jimni1222 jimni1222 self-assigned this Mar 4, 2020
@jimni1222 jimni1222 changed the title Request manager Use setRequestManager instead of setProvider for adding data listener once only Mar 4, 2020
Co-Authored-By: Junghyun Colin Kim <Colin.kim@groundx.xyz>
@jimni1222 jimni1222 merged commit b67bdbb into klaytn:dev Mar 4, 2020
@jimni1222 jimni1222 deleted the requestManager branch March 4, 2020 04:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MaxListenersExceededWarning
2 participants