Skip to content

Commit

Permalink
Do not reload worker when models change
Browse files Browse the repository at this point in the history
  • Loading branch information
phlmn committed Dec 17, 2023
1 parent 3418d87 commit bab12c8
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
Expand Up @@ -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()
Expand Down

0 comments on commit bab12c8

Please sign in to comment.