diff --git a/docs/contrib/scheduler.md b/docs/contrib/scheduler.md index 1e8d8e2..bc8ee4c 100644 --- a/docs/contrib/scheduler.md +++ b/docs/contrib/scheduler.md @@ -60,3 +60,9 @@ python command.py scheduler run d41d8cd98f00b204e9800998ecf8427e # run by OS-sc - `PERIODIC_JOBS_USERNAME` (str, Windows only) - by default `"System"` - `PERIODIC_JOBS_PASSWORD` (str, Windows only) - by default `None` - `PERIODIC_JOBS_BACKEND` (str) - path to override default backend class - by default `None` + +#### Note about console popup on Windows + +If Windows scheduler task with default Python executable shows up console popup on each run, +you may want to substitute `python.exe` with `pythonw.exe` in `PERIODIC_JOBS_PYTHON_EXECUTABLE`. +Note, that it has its own [caveats](https://stackoverflow.com/a/30313091). diff --git a/starlette_web/contrib/scheduler/backends/win32.py b/starlette_web/contrib/scheduler/backends/win32.py index f04365c..b977857 100644 --- a/starlette_web/contrib/scheduler/backends/win32.py +++ b/starlette_web/contrib/scheduler/backends/win32.py @@ -109,7 +109,7 @@ def update_jobs(self): execution_time_limit=False, force_stop=True, delete_after=False, - multiple_instances=not self.settings.LOCK_JOBS, + multiple_instances=["Parallel", "No New Instance"][self.settings.LOCK_JOBS], action_type="Execute", cmd=self.settings.PYTHON_EXECUTABLE, arguments=(