Resolved

Python watchdog fails to detect files moved with shutil move

Python
Filesystem
Watchdog
Async
Debugging
Event Handling
File Operations

Files moved via shutil.move on same filesystem trigger on_moved events but not on_created handlers | Python watchdog library misses file operations when using atomic rename

Issue

The upload watcher system failed to detect newly generated videos when they were moved into the upload directory using atomic operations. Videos appeared in the directory and were logged, but they were not processed or uploaded until the watcher was manually restarted.

Culprit

The system only monitored file creation events (on_created) but did not account for file move events (on_moved). Since atomic file operations like shutil.move() trigger on_moved instead of on_created, these events were ignored, causing videos to remain undetected during continuous operation.

Solution

The watcher system was updated to include a handler for file move events, allowing it to detect and process videos moved into the upload directory. A shared processing method was introduced to handle both creation and move events, ensuring all videos are detected and processed promptly without requiring manual intervention.