watch is now cmd line arg

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
Marc 'risson' Schmitt
2025-06-23 17:18:23 +02:00
parent 07ff433134
commit e5b86c3578
2 changed files with 9 additions and 2 deletions

View File

@ -87,7 +87,6 @@ class Conf:
def worker(self) -> dict[str, Any]:
return {
"use_gevent": False,
"watch": settings.DEBUG,
"watch_use_polling": False,
"processes": None,
"threads": None,

View File

@ -19,17 +19,25 @@ class Command(BaseCommand):
dest="pid_file",
help="PID file",
)
parser.add_argument(
"--watch",
action="store_true",
default=False,
dest="watch",
help="Watch for file changes",
)
def handle(
self,
pid_file,
watch,
verbosity,
**options,
):
worker = Conf().worker
executable_name = "dramatiq-gevent" if worker["use_gevent"] else "dramatiq"
executable_path = self._resolve_executable(executable_name)
watch_args = ["--watch", "."] if worker["watch"] else []
watch_args = ["--watch", "."] if watch else []
if watch_args and worker["watch_use_polling"]:
watch_args.append("--watch-use-polling")