Skip to content

Commit c3ccdf5

Browse files
authored
ignore certain file formats from granian hot reload (#5326)
1 parent 5e98da0 commit c3ccdf5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

reflex/utils/exec.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,23 @@ def run_uvicorn_backend(host: str, port: int, loglevel: LogLevel):
374374
)
375375

376376

377+
HOTRELOAD_IGNORE_EXTENSIONS = (
378+
"txt",
379+
"toml",
380+
"sqlite",
381+
"yaml",
382+
"yml",
383+
"json",
384+
"sh",
385+
"bash",
386+
)
387+
388+
HOTRELOAD_IGNORE_PATTERNS = (
389+
*[rf"^.*\.{ext}$" for ext in HOTRELOAD_IGNORE_EXTENSIONS],
390+
r"^[^\.]*$", # Ignore files without an extension
391+
)
392+
393+
377394
def run_granian_backend(host: str, port: int, loglevel: LogLevel):
378395
"""Run the backend in development mode using Granian.
379396
@@ -403,6 +420,7 @@ def run_granian_backend(host: str, port: int, loglevel: LogLevel):
403420
reload=True,
404421
reload_paths=get_reload_paths(),
405422
reload_ignore_worker_failure=True,
423+
reload_ignore_patterns=HOTRELOAD_IGNORE_PATTERNS,
406424
reload_tick=100,
407425
workers_kill_timeout=2,
408426
).serve()

0 commit comments

Comments
 (0)