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

Raise exceptions by default; opt to silence in message listener task #3202

Merged

Conversation

fselmo
Copy link
Collaborator

@fselmo fselmo commented Jan 25, 2024

What was wrong?

It is often best to fail hard and fast and be able to silence exceptions rather than let exceptions possibly go unnoticed. We were defaulting to silencing exceptions in the message listener task for WebsocketProviderV2. This hasn't been released yet and so this change just aims to tweak the configuration and opt to silence exceptions that are raised by default.

How was it fixed?

  • raise_listener_task_exceptions -> silence_listener_task_exceptions
  • Modify tests accordingly
  • Close all current tasks in the loop before raising the exception

Todo:

Cute Animal Picture

20240123_141138

fselmo added a commit to fselmo/web3.py that referenced this pull request Jan 25, 2024
@fselmo fselmo marked this pull request as ready for review January 25, 2024 00:06
@fselmo fselmo requested review from reedsa, kclowes and pacrob January 25, 2024 00:07
@fselmo fselmo force-pushed the raise-listener-task-exceptions-by-default branch from 3e83607 to 1615a97 Compare January 25, 2024 00:10
@pacrob
Copy link
Contributor

pacrob commented Jan 25, 2024

Update looks good, but I don't see any reference to this option in docs. Is that coming separately, or should be added here?

Copy link
Contributor

@pacrob pacrob left a comment

Choose a reason for hiding this comment

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

lgtm!

@fselmo fselmo force-pushed the raise-listener-task-exceptions-by-default branch from 10fda00 to 18a632a Compare January 25, 2024 17:49
@fselmo
Copy link
Collaborator Author

fselmo commented Jan 25, 2024

@pacrob I added a more extensive update of the docs here since it was stale. Thanks for the poke. Take a look again and lmk if anything looks off. I also took the endpoint_uri out of the base PersistentConnectionProvider class, opting to only keep it in the inheriting classes which are the actual provider classes.

- Remove the ``endpoint_uri`` argument from the ``PersistentConenctionProvider`` base class, opting for defining it in the inheriting classes instead.
- Update the documentation around the ``WebsocketProviderV2`` class to reflect the current state + document ``PersistentConenctionProvider`` under a new section.
@fselmo fselmo force-pushed the raise-listener-task-exceptions-by-default branch from 18a632a to d3bab44 Compare January 25, 2024 17:54
fselmo added a commit to fselmo/web3.py that referenced this pull request Jan 25, 2024
@fselmo fselmo requested a review from pacrob January 25, 2024 18:33
Copy link
Contributor

@pacrob pacrob left a comment

Choose a reason for hiding this comment

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

lgtm!

@fselmo fselmo merged commit 47dd1b7 into ethereum:main Jan 25, 2024
81 checks passed
fselmo added a commit that referenced this pull request Jan 25, 2024
@fselmo fselmo deleted the raise-listener-task-exceptions-by-default branch January 25, 2024 18:36
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.

2 participants