Add interval sleep in reloader (#2595)

This commit is contained in:
Adam Hopkins 2022-10-31 12:34:01 +02:00 committed by GitHub
parent 5369291c27
commit 65d7447cf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,6 +9,7 @@ from multiprocessing.connection import Connection
from pathlib import Path
from signal import SIGINT, SIGTERM
from signal import signal as signal_func
from time import sleep
from typing import Dict, Set
from sanic.server.events import trigger_events
@ -62,6 +63,7 @@ class Reloader:
self.reload(",".join(changed) if changed else "unknown")
if after_trigger:
trigger_events(after_trigger, loop, app)
sleep(self.interval)
else:
if reloader_stop:
trigger_events(reloader_stop, loop, app)