Wait for copy, avoid overlapping file events #441
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull request
CLA
of my work contained in that pull request to the Unmanic project and the project
owner. My contribution will become licensed under the same license as the overall project.
This extends upon paragraph 11 of the Terms & Conditions stipulated in the GPL v3.0
Checklist
I have ensured that my pull request is being opened to merge into the staging branch.
I have ensured that all new python file contributions contain the correct header as
stipulated in the Contributing Docs.
Problem Statement:
During testing, it was observed that Unmanic would attempt to test/process files before they were fully written to disk. In my setup, file copying to shared/mounted drives can sometimes take a minute or two to complete.
Additionally, a single file copy was found to trigger multiple overlapping
created
andmodified
events. This caused the file monitoring system to repeatedly attempt testing the same file.Proposed Changes in This PR:
This PR aims to address these issues by implementing the following fixes:
created
andmodified
events to accurately capture file changes across all test scenarios.Before Changes
Simulate a slow file copy
rsync --inplace --bwlimit=39321 --progress ~/Movie.mkv ~/Code/unmanic-docker/library
File system copy
cp ~/Movie.mkv ~/Code/unmanic-docker/library
Directly move a file
mv Movie.mkv foo.mkv
Create a file
touch hello.mkv
Modify a file
echo "hello" >> hello.mkv
Create a new file by copying an existing
cp foo.mkv new.mkv
After Changes
Simulate a slow file copy
rsync --inplace --bwlimit=39321 --progress ~/Movie.mkv ~/Code/unmanic-docker/library
File system copy
cp ~/Movie.mkv ~/Code/unmanic-docker/library
Directly move a file
mv Movie.mkv foo.mkv
Create a file
touch hello.mkv
Modify a file
echo "hello" >> hello.mkv
Create a new file by copying an existing
cp foo.mkv new.mkv