Repository navigation
stuck in a reload loop #565
Description
Activity
Perhaps adding an environment variable
TASKIQ_RELOAD_IGNORE_EVENT_TYPEwould be a good idea.I am looking at the same issue. For me it is close no write events on
__pycache__files which live under my monitored folders.
I am getting around this for now by monkey patching theFileWatcherdispatch method.Okay. Seems like like something has changed in the way we watch for files. Maybe lib update.
As a workaround you can add
--reload-dir {project_dir}. This workaround will solve your issue. But I still need to look into it to resolve this problem without any arguments.This is also happening for me on
__pycache__files, and the file watcher doesn't seem to be respecting my.gitignore.taskiq_worker-1 | [2025-12-20 18:00:04,902][taskiq.worker][DEBUG ][worker-0] UVLOOP found. Using it as async runner taskiq_worker-1 | [2025-12-20 18:00:04,903][taskiq.worker][DEBUG ][worker-0] Inserting /app in sys.path taskiq_worker-1 | [2025-12-20 18:00:04,905][taskiq.worker][DEBUG ][MainProcess] File changed. Event: FileClosedNoWriteEvent(src_path='app/__pycache__/__init__.cpython-313.pyc', dest_path='', event_type='closed_no_write', is_directory=False, is_synthetic=False) taskiq_worker-1 | [2025-12-20 18:00:04,905][taskiq.process-manager][INFO ][MainProcess] Scheduled workers reload. taskiq_worker-1 | [2025-12-20 18:00:04,907][taskiq.worker][DEBUG ][MainProcess] File changed. Event: FileClosedNoWriteEvent(src_path='app/tasks/__pycache__/tk.cpython-313.pyc', dest_path='', event_type='closed_no_write', is_directory=False, is_synthetic=False) taskiq_worker-1 | [2025-12-20 18:00:04,907][taskiq.process-manager][INFO ][MainProcess] Scheduled workers reload. taskiq_worker-1 | [2025-12-20 18:00:04,952][taskiq.worker][DEBUG ][MainProcess] File changed. Event: FileClosedNoWriteEvent(src_path='app/__pycache__/settings.cpython-313.pyc', dest_path='', event_type='closed_no_write', is_directory=False, is_synthetic=False) taskiq_worker-1 | [2025-12-20 18:00:04,953][taskiq.process-manager][INFO ][MainProcess] Scheduled workers reload. taskiq_worker-1 | [2025-12-20 18:00:04,965][taskiq.worker][DEBUG ][worker-0] Inserting /app in sys.path taskiq_worker-1 | [2025-12-20 18:00:04,965][taskiq.worker][DEBUG ][worker-0] Initialize receiver. taskiq_worker-1 | [2025-12-20 18:00:04,966][taskiq.worker][DEBUG ][worker-0] Inserting /app in sys.path taskiq_worker-1 | [2025-12-20 18:00:04,967][taskiq.worker][DEBUG ][MainProcess] File changed. Event: FileClosedNoWriteEvent(src_path='app/__pycache__/main.cpython-313.pyc', dest_path='', event_type='closed_no_write', is_directory=False, is_synthetic=False) taskiq_worker-1 | [2025-12-20 18:00:04,967][taskiq.process-manager][INFO ][MainProcess] Scheduled workers reload. taskiq_worker-1 | [2025-12-20 18:00:05,005][root][DEBUG ][MainProcess] Got event: ReloadOneAction(worker_num=0, is_reload_all=True) taskiq_worker-1 | [2025-12-20 18:00:05,005][root][DEBUG ][MainProcess] Got event: ReloadOneAction(worker_num=0, is_reload_all=True) taskiq_worker-1 | [2025-12-20 18:00:05,005][root][DEBUG ][MainProcess] Got event: ReloadOneAction(worker_num=0, is_reload_all=True) taskiq_worker-1 | [2025-12-20 18:00:05,005][root][DEBUG ][MainProcess] Got event: ReloadOneAction(worker_num=0, is_reload_all=True)Reacted by daysonIt seems #568 fixes this issue. Any chances of having a point release with this fix soon?
Confirmed this affects 0.12.1 on Linux with an OrbStack Docker bind mount.
I managed to work around it by monkey-patching FileWatcher.dispatch to add "closed_no_write" to the filtered event types.
The--reload-dirworkaround doesn't fully resolve it as the events still originate from within the specified directory.Looking forward to a 0.12.2 release. Cheers.
The release has happened and this issue should be resolved. Please verify the fix and consider closing if the problem is gone.
Taskiq version
0.12.1
Python version
Python 3.12
OS
Linux
What happened?
In
taskiq/cli/watcher.py, only the event types "opened" and "closed" were ignored. The "closed_no_write" event triggered an endless loop.this is code:
Relevant log output
Broker initialization code