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 loop argument to signal router finalize method to finalize without having a running loop #2830

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

eelkevdbos
Copy link

Closes #2829

@eelkevdbos eelkevdbos requested a review from a team as a code owner September 27, 2023 05:10
ahopkins
ahopkins previously approved these changes Sep 27, 2023
Copy link
Member

@ahopkins ahopkins left a comment

Choose a reason for hiding this comment

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

😎 Nice. Thanks for raising the issue and making the fix.

I did not look at the reason for the failing tests, but I would guess it is a formatting thing.

There should be a command in the Makefile to run black across the repo.

@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (a5a9658) 88.387% compared to head (e6e31d0) 88.429%.

Additional details and impacted files
@@              Coverage Diff              @@
##              main     #2830       +/-   ##
=============================================
+ Coverage   88.387%   88.429%   +0.041%     
=============================================
  Files           92        92               
  Lines         7156      7156               
  Branches      1228      1228               
=============================================
+ Hits          6325      6328        +3     
+ Misses         575       574        -1     
+ Partials       256       254        -2     
Files Coverage Δ
sanic/signals.py 91.549% <100.000%> (ø)

... and 1 file with indirect coverage changes

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

@eelkevdbos
Copy link
Author

eelkevdbos commented Oct 10, 2023

@ahopkins I've updated the formatting and doc blocks, but a seemingly unrelated test is failing. Is this test perhaps also failing on main or do I need to dig deeper into the issue?

@Tronic
Copy link
Member

Tronic commented Oct 11, 2023

I gather you should use asyncio to set the loop or otherwise execute within its normal bounds, rather than passing loop arguments. It is worth noting that asyncio itself just went though a removal of loop argument passing.

@eelkevdbos
Copy link
Author

eelkevdbos commented Oct 11, 2023

I gather you should use asyncio to set the loop or otherwise execute within its normal bounds, rather than passing loop arguments. It is worth noting that asyncio itself just went though a removal of loop argument passing.

@Tronic Do you object merging this and suggest injecting the loop differently? I'm happy to go a different route, but provided PR at least works fine in my use case (#2829). The failing test seems an artifact from a failing main branch test (https://github.com/sanic-org/sanic/actions/runs/6109680961/job/16624825220).

@ahopkins Just as a sanity check, I can't see any uses of the self.ctx.loop when doing a search for references. Does the finalize method use the loop somewhere? Or is it being set up here for later use in the signal router lifecycle?

@Tronic
Copy link
Member

Tronic commented Oct 11, 2023

Can you use asyncio.set_event_loop(loop) for that?

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.

Allow the signal router to finalize without a running event loop
3 participants