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

Better exceptions #15

Merged
merged 3 commits into from
Sep 5, 2020
Merged

Better exceptions #15

merged 3 commits into from
Sep 5, 2020

Conversation

MrNaif2018
Copy link
Member

@MrNaif2018 MrNaif2018 commented Sep 4, 2020

bitcart/bitcart#115
TODO before merging: remove checking out from better-exceptions branch

@codecov
Copy link

codecov bot commented Sep 4, 2020

Codecov Report

Merging #15 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #15   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines          309       321   +12     
=========================================
+ Hits           309       321   +12     
Impacted Files Coverage Δ
bitcart/coins/btc.py 100.00% <100.00%> (ø)
bitcart/errors.py 100.00% <100.00%> (ø)
bitcart/event_delivery.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 262e299...bf91ea3. Read the comment docs.

"""Unknown error code returned from server"""


@functools.lru_cache()

Choose a reason for hiding this comment

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

default max_size is 128. Do we want to set it as None to max?

Copy link
Member Author

Choose a reason for hiding this comment

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

From docs:

If maxsize is set to None, the LRU feature is disabled and the cache can grow without bound.

I think LRU cache is useful here, as in many cases it will work like so:
Exception is generated and raised, and in exception handlers, users also catch that exception, so exception is returned from cache, as it is was used recently.
If we disable LRU, doesn't the cache grow indefinitely?
I don't think more than 128 exceptions limit will ever be reached anyway.

@MrNaif2018 MrNaif2018 merged commit 75bafbe into master Sep 5, 2020
@MrNaif2018 MrNaif2018 deleted the better-exceptions branch September 5, 2020 18:19
@MrNaif2018 MrNaif2018 mentioned this pull request Sep 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants