Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve token's controllers by avoiding unnecessary preloads #2216

Merged
merged 3 commits into from
Jul 1, 2019

Conversation

pasqu4le
Copy link
Contributor

@pasqu4le pasqu4le commented Jun 21, 2019

Motivation

Much like #2111 did for transactions, here a token preload has been made optional to avoid performing it when there is no need to.

NOTE: unlike the mentioned PR here the default is to not perform any preload, because there are more calls that don't need it than those who do (including outside of controllers).

Changelog

Enhancements

All token pages with type: JSON will be affected as well as a few other calls outside of controllers.

Checklist for your PR

  • I added an entry to CHANGELOG.md with this PR
  • If I added new functionality, I added tests covering it.
  • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • I checked whether I should update the docs and did so if necessary

@pasqu4le pasqu4le self-assigned this Jun 21, 2019
@pasqu4le pasqu4le added the ready for review This PR is ready for reviews. label Jun 21, 2019
@coveralls
Copy link

coveralls commented Jun 21, 2019

Pull Request Test Coverage Report for Build c4bf68a1-599a-4cb0-8c6b-39c3ffe124fd

  • 6 of 7 (85.71%) changed or added relevant lines in 7 files are covered.
  • 9 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.1%) to 81.123%

Changes Missing Coverage Covered Lines Changed/Added Lines %
apps/block_scout_web/lib/block_scout_web/controllers/tokens/transfer_controller.ex 0 1 0.0%
Files with Coverage Reduction New Missed Lines %
apps/indexer/lib/indexer/fetcher/replaced_transaction.ex 2 90.91%
apps/indexer/lib/indexer/block/catchup/bound_interval_supervisor.ex 3 85.19%
apps/indexer/lib/indexer/block/catchup/fetcher.ex 4 69.23%
Totals Coverage Status
Change from base Build 41ce7444-72d1-4dbf-a6ab-fcec8a42aade: -0.1%
Covered Lines: 5114
Relevant Lines: 6304

💛 - Coveralls

@vbaranov vbaranov requested a review from Heimdell June 22, 2019 15:02
@pasqu4le pasqu4le force-pushed the improve-tokens-controllers branch from 83569c4 to ebb1628 Compare June 24, 2019 07:59
@@ -5,6 +5,7 @@
- [#2075](https://github.com/poanetwork/blockscout/pull/2075) - add blocks cache
- [#2151](https://github.com/poanetwork/blockscout/pull/2151) - hide dropdown menu then other networks list is empty
- [#2146](https://github.com/poanetwork/blockscout/pull/2146) - feat: add eth_getLogs rpc endpoint
- [#2216](https://github.com/poanetwork/blockscout/pull/2216) - Improve token's controllers by avoiding unnecessary preloads
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's move it under Chore since it only refactors code

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it can be considered only refactoring code, all the calls to token_from_address_hash that have not been changed now ask for (and get in return) a different value.

vbaranov added a commit that referenced this pull request Jun 24, 2019
@vbaranov vbaranov merged commit 285d5ae into master Jul 1, 2019
@vbaranov vbaranov deleted the improve-tokens-controllers branch July 2, 2019 15:15
pasqu4le added a commit that referenced this pull request Jul 19, 2019
Problem: after #2111, #2249, #2216 and #2305 a few remaining controllers still have not been checked for possible improvements.

Solution: check them and remove unnecessary preloads and queries.
@pasqu4le pasqu4le mentioned this pull request Jul 19, 2019
4 tasks
pasqu4le added a commit that referenced this pull request Jul 19, 2019
Problem: after #2111, #2249, #2216 and #2305 a few remaining controllers still have not been checked for possible improvements.

Solution: check them and remove unnecessary preloads and queries.
pasqu4le added a commit that referenced this pull request Jul 19, 2019
Problem: after #2111, #2249, #2216 and #2305 a few remaining controllers still have not been checked for possible improvements.

Solution: check them and remove unnecessary preloads and queries.
vbaranov pushed a commit that referenced this pull request Jul 23, 2019
Problem: after #2111, #2249, #2216 and #2305 a few remaining controllers still have not been checked for possible improvements.

Solution: check them and remove unnecessary preloads and queries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review This PR is ready for reviews.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants