mirror of
https://github.com/calibrain/shelfmark.git
synced 2026-10-04 06:41:12 +01:00
Fix: File movement trigger event (#691)
Creates IN_MOVED_TO event, fixes CWA ingest folder detection when file movement fallback occurs
This commit is contained in:
@@ -289,6 +289,13 @@ def _publish_temp_file(temp_path: Path, dest_path: Path) -> bool:
|
||||
"""
|
||||
try:
|
||||
run_blocking_io(os.link, str(temp_path), str(dest_path))
|
||||
# Trigger IN_CLOSE_WRITE so inotify-based file watchers (e.g. CWA) detect the new file.
|
||||
# os.link() only generates IN_CREATE which many watchers don't monitor.
|
||||
try:
|
||||
fd = run_blocking_io(os.open, str(dest_path), os.O_WRONLY)
|
||||
run_blocking_io(os.close, fd)
|
||||
except OSError:
|
||||
pass
|
||||
run_blocking_io(temp_path.unlink, missing_ok=True)
|
||||
return True
|
||||
except FileExistsError:
|
||||
|
||||
Reference in New Issue
Block a user