Skip to content

Commit

Permalink
Do not reload worker when models change
Browse files Browse the repository at this point in the history
phlmn committed Dec 17, 2023
1 parent 88c6f0f commit 06b7ef9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion worker/run.py
Original file line number Diff line number Diff line change
@@ -57,7 +57,11 @@ def main():
stop_watching_event = asyncio.Event()
p = run_sync_in_process(stop_watching_event, args)

for _ in watch(path, stop_event=stop_watching_event):
def watch_filter(change, path: str):
# do not reload when models are downloaded
return not path.startswith(settings.MODELS_DIR.absolute().as_posix())

for _ in watch(path, watch_filter=watch_filter, stop_event=stop_watching_event):
logging.info("Source code change detected, reloading worker")
p.terminate()
p.join()

0 comments on commit 06b7ef9

Please sign in to comment.