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

Reload interval on class variable #2633

Merged
merged 1 commit into from Dec 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion sanic/mixins/startup.py
Expand Up @@ -825,7 +825,7 @@ def serve(
reload_dirs: Set[Path] = primary.state.reload_dirs.union(
*(app.state.reload_dirs for app in apps)
)
reloader = Reloader(monitor_pub, 1.0, reload_dirs, app_loader)
reloader = Reloader(monitor_pub, 0, reload_dirs, app_loader)
manager.manage("Reloader", reloader, {}, transient=False)

inspector = None
Expand Down
4 changes: 3 additions & 1 deletion sanic/worker/reloader.py
Expand Up @@ -17,6 +17,8 @@


class Reloader:
INTERVAL = 1.0 # seconds

def __init__(
self,
publisher: Connection,
Expand All @@ -25,7 +27,7 @@ def __init__(
app_loader: AppLoader,
):
self._publisher = publisher
self.interval = interval
self.interval = interval or self.INTERVAL
self.reload_dirs = reload_dirs
self.run = True
self.app_loader = app_loader
Expand Down