Reload interval on class variable (#2633)
This commit is contained in:
parent
0e44e9cacb
commit
518152d97e
@ -825,7 +825,7 @@ class StartupMixin(metaclass=SanicMeta):
|
|||||||
reload_dirs: Set[Path] = primary.state.reload_dirs.union(
|
reload_dirs: Set[Path] = primary.state.reload_dirs.union(
|
||||||
*(app.state.reload_dirs for app in apps)
|
*(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)
|
manager.manage("Reloader", reloader, {}, transient=False)
|
||||||
|
|
||||||
inspector = None
|
inspector = None
|
||||||
|
@ -17,6 +17,8 @@ from sanic.worker.loader import AppLoader
|
|||||||
|
|
||||||
|
|
||||||
class Reloader:
|
class Reloader:
|
||||||
|
INTERVAL = 1.0 # seconds
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
publisher: Connection,
|
publisher: Connection,
|
||||||
@ -25,7 +27,7 @@ class Reloader:
|
|||||||
app_loader: AppLoader,
|
app_loader: AppLoader,
|
||||||
):
|
):
|
||||||
self._publisher = publisher
|
self._publisher = publisher
|
||||||
self.interval = interval
|
self.interval = interval or self.INTERVAL
|
||||||
self.reload_dirs = reload_dirs
|
self.reload_dirs = reload_dirs
|
||||||
self.run = True
|
self.run = True
|
||||||
self.app_loader = app_loader
|
self.app_loader = app_loader
|
||||||
|
Loading…
x
Reference in New Issue
Block a user