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

Add try except to messaging connection #345

Merged
merged 4 commits into from
Jan 9, 2024
Merged

Conversation

abbiemery
Copy link
Contributor

@abbiemery abbiemery commented Jan 4, 2024

Addresses #220 (after a fashion).

This is just a try except around the connection attempt. It displays the failure to connect in the logs but does not fail fast. It allows the rest of the application setup to complete just without a connection to a message bus. You can then crtl+c to close it.

I would have preferred to fail fast if we are demanding the presence of a message bus, however trying to address exceptions in the fastapi lifespan caused things to hang. The I was advised to just add this crude fix until the subprocess work is done then we can re-address the behaviour we want for each of these cases.

Copy link
Collaborator

@callumforrester callumforrester left a comment

Choose a reason for hiding this comment

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

I think we should merge this but not close #220 as we would still like an automatic shutdown after connection failure, which should hopefully be easier once #343 is merged

src/blueapi/messaging/stomptemplate.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jan 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (c5bf8f9) 87.14% compared to head (e0ae83f) 87.17%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #345      +/-   ##
==========================================
+ Coverage   87.14%   87.17%   +0.02%     
==========================================
  Files          42       42              
  Lines        1642     1645       +3     
==========================================
+ Hits         1431     1434       +3     
  Misses        211      211              

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

@abbiemery abbiemery marked this pull request as ready for review January 9, 2024 14:51
@abbiemery abbiemery merged commit cad6bc0 into main Jan 9, 2024
23 checks passed
@abbiemery abbiemery deleted the best-effort-startup branch January 9, 2024 15:46
@abbiemery abbiemery restored the best-effort-startup branch January 9, 2024 15:46
ZohebShaikh pushed a commit that referenced this pull request May 7, 2024
Just a try except around the connection attempt. It displays the
failure to connect in the logs but does not fail fast. It allows the
rest of the application setup to complete just without a connection to a
message bus. You can then `crtl+c` to close it.

I was advised to just add this fix until the subprocess work is done
then we can re-address the behaviour we want.
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

3 participants