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 two new events on the reloader process #2413

Merged
merged 5 commits into from Mar 22, 2022
Merged

Add two new events on the reloader process #2413

merged 5 commits into from Mar 22, 2022

Conversation

ahopkins
Copy link
Member

This PR adds two new events that wrap the RELOAD process.

@app.reload_process_start
async def reload_start(*_):
    print(">>>>>> reload_start <<<<<<")


@app.reload_process_stop
async def reload_stop(*_):
    print(">>>>>> reload_stop <<<<<<")

These events will ONLY be triggered when auto-reload is enabled. Whereas the main_* events are processed when a reload is triggered, because these are executed on the reload process, they are not triggered.

The use case is for development process work (ex. setting up a livereload server).

@codecov
Copy link

codecov bot commented Mar 22, 2022

Codecov Report

Merging #2413 (753a8d3) into main (0c9df02) will increase coverage by 0.115%.
The diff coverage is 100.000%.

@@              Coverage Diff              @@
##              main     #2413       +/-   ##
=============================================
+ Coverage   87.110%   87.225%   +0.115%     
=============================================
  Files           60        60               
  Lines         5004      5010        +6     
  Branches       905       904        -1     
=============================================
+ Hits          4359      4370       +11     
+ Misses         472       468        -4     
+ Partials       173       172        -1     
Impacted Files Coverage Δ
sanic/mixins/listeners.py 100.000% <100.000%> (ø)
sanic/mixins/runner.py 95.744% <100.000%> (+0.851%) ⬆️
sanic/server/protocols/http_protocol.py 88.095% <0.000%> (+3.571%) ⬆️

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 0c9df02...753a8d3. Read the comment docs.

@ahopkins ahopkins marked this pull request as ready for review March 22, 2022 19:21
@ahopkins ahopkins requested a review from a team as a code owner March 22, 2022 19:21
@ahopkins ahopkins merged commit 2a8e910 into main Mar 22, 2022
@ahopkins ahopkins deleted the dev-event branch March 22, 2022 21:29
ChihweiLHBird pushed a commit to ChihweiLHBird/sanic that referenced this pull request Jun 1, 2022
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

1 participant