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 NotConnectedError in UpdateHandler.check_connection #71

Merged
merged 1 commit into from
Jul 4, 2024

Conversation

hmpf
Copy link
Contributor

@hmpf hmpf commented Jul 3, 2024

… instead of AttributeError when something nasty has happened to the session object.

For first part of #68

… instead of AttributeError when something nasty has happened to the
session object.
@hmpf hmpf added bug Something isn't working uncaught exception Subtype of bug labels Jul 3, 2024
@hmpf hmpf requested a review from podliashanyk July 3, 2024 09:30
@hmpf hmpf self-assigned this Jul 3, 2024
Copy link

codecov bot commented Jul 3, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 70.25%. Comparing base (f13d7ad) to head (614f019).

Files Patch % Lines
src/zinolib/controllers/zino1.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #71      +/-   ##
==========================================
- Coverage   70.35%   70.25%   -0.10%     
==========================================
  Files          13       13              
  Lines        1464     1466       +2     
==========================================
  Hits         1030     1030              
- Misses        434      436       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@podliashanyk podliashanyk left a comment

Choose a reason for hiding this comment

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

I am not sure it is a sufficient fix for first part of #68. It addresses the traceback specifically yes, but I see several more places in UpdateHandler code where same error might occur (The list is not exhaustive!):

  1. connect() in UpdateHandler checks EventManager's session before calling the now fixed check_connection
  2. update() and remove() in UpdateHandler call EventManager (including manager's methods that don't call _verify_session) yet never call check_connection
  3. more?

Furthermore, while first part in #68 was exposed when calling UpdateHandler, it concerns the session from EventManager. Shouldn't we address the problem in EventManager?

@hmpf
Copy link
Contributor Author

hmpf commented Jul 3, 2024

I am not sure it is a sufficient fix for first part of #68. It addresses the traceback specifically yes, but I see several more places in UpdateHandler code where same error might occur (The list is not exhaustive!):

1. `connect()` in UpdateHandler checks EventManager's session **before** calling the now fixed `check_connection`

Fair.

Instead of always returning the session object, connect_push_channel will raise a "NotConnectedError" if the connection could not be made.

2. `update()` and `remove()` in UpdateHandler call EventManager (including manager's methods that don't call `_verify_session`) yet never call `check_connection`

Not applicable.

update calls self.manager.get_updated_event_for_id(event_id) which eventually calls _verify_session before it tries talking on the net.

remove does not need a working connection, it only manipulates the local dict of events and the removed_ids set.

3. more?

Not in UpdateHandler.

Furthermore, while first part in #68 was exposed when calling UpdateHandler, it concerns the session from EventManager. Shouldn't we address the problem in EventManager?

SessionAdapter actually. See new commit.

@hmpf hmpf requested a review from podliashanyk July 3, 2024 12:30
Copy link
Contributor

@podliashanyk podliashanyk left a comment

Choose a reason for hiding this comment

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

Some breaking changes, can no longer establish any connection to zino

@hmpf hmpf force-pushed the updatehandler-notconnected branch from 614f019 to 0a1e7e8 Compare July 4, 2024 07:27
@hmpf
Copy link
Contributor Author

hmpf commented Jul 4, 2024

Last commit removed.

@hmpf hmpf requested a review from podliashanyk July 4, 2024 07:27
@hmpf hmpf merged commit 71f7a4d into Uninett:main Jul 4, 2024
9 of 13 checks passed
@hmpf hmpf deleted the updatehandler-notconnected branch July 4, 2024 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working uncaught exception Subtype of bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants