|
6 | 6 | from dataclasses import dataclass |
7 | 7 | from multiprocessing import Event, Process, Queue, current_process |
8 | 8 | from multiprocessing.synchronize import Event as EventType |
| 9 | +from pathlib import Path |
9 | 10 | from time import sleep |
10 | 11 | from typing import Any, Callable, List, Optional |
11 | 12 |
|
@@ -163,15 +164,19 @@ def __init__( |
163 | 164 | self.action_queue: "Queue[ProcessActionBase]" = Queue(-1) |
164 | 165 | self.args = args |
165 | 166 | if args.reload and observer is not None: |
166 | | - observer.schedule( |
167 | | - FileWatcher( |
168 | | - callback=schedule_workers_reload, |
169 | | - use_gitignore=not args.no_gitignore, |
170 | | - action_queue=self.action_queue, |
171 | | - ), |
172 | | - path=".", |
173 | | - recursive=True, |
174 | | - ) |
| 167 | + watch_paths = args.reload_dirs if args.reload_dirs else ["."] |
| 168 | + for path_to_watch in watch_paths: |
| 169 | + logger.debug(f"Watching directory: {path_to_watch}") |
| 170 | + observer.schedule( |
| 171 | + FileWatcher( |
| 172 | + callback=schedule_workers_reload, |
| 173 | + path=Path(path_to_watch), |
| 174 | + use_gitignore=not args.no_gitignore, |
| 175 | + action_queue=self.action_queue, |
| 176 | + ), |
| 177 | + path=path_to_watch, |
| 178 | + recursive=True, |
| 179 | + ) |
175 | 180 |
|
176 | 181 | shutdown_handler = get_signal_handler(self.action_queue, ShutdownAction()) |
177 | 182 | signal.signal(signal.SIGINT, shutdown_handler) |
|
0 commit comments