file_manager: don't queue "create from move" events
Treat these events as if they were actual file write events. They will reset the node completion time and suppress the notifcation. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
45506647a7
commit
51e307dbd6
|
@ -1783,16 +1783,21 @@ class INotifyHandler:
|
||||||
else:
|
else:
|
||||||
pending_node.queue_move_notification(args)
|
pending_node.queue_move_notification(args)
|
||||||
else:
|
else:
|
||||||
|
if pending_node is not None:
|
||||||
|
logging.debug(
|
||||||
|
"Parent node is processing, suppressing 'create from move' "
|
||||||
|
f"notification: {file_path}"
|
||||||
|
)
|
||||||
|
pending_node.reset_event("create_node", INOTIFY_BUNDLE_TIME)
|
||||||
|
if root == "gcodes":
|
||||||
|
self.parse_gcode_metadata(file_path)
|
||||||
|
return
|
||||||
self.sync_lock.add_pending_path("create_file", file_path)
|
self.sync_lock.add_pending_path("create_file", file_path)
|
||||||
if root == "gcodes":
|
if root == "gcodes":
|
||||||
coro = self._finish_gcode_create_from_move(file_path, pending_node)
|
coro = self._finish_gcode_create_from_move(file_path)
|
||||||
self.queue_gcode_notificaton(coro)
|
self.queue_gcode_notificaton(coro)
|
||||||
else:
|
else:
|
||||||
args = ["create_file", root, file_path]
|
self.notify_filelist_changed("create_file", root, file_path)
|
||||||
if pending_node is None:
|
|
||||||
self.notify_filelist_changed(*args)
|
|
||||||
else:
|
|
||||||
pending_node.queue_move_notification(args)
|
|
||||||
elif evt.mask & iFlags.MODIFY:
|
elif evt.mask & iFlags.MODIFY:
|
||||||
self.sync_lock.add_pending_path("modify_file", file_path)
|
self.sync_lock.add_pending_path("modify_file", file_path)
|
||||||
node.schedule_file_event(evt.name, "modify_file")
|
node.schedule_file_event(evt.name, "modify_file")
|
||||||
|
@ -1822,16 +1827,10 @@ class INotifyHandler:
|
||||||
else:
|
else:
|
||||||
pending_node.queue_move_notification(args)
|
pending_node.queue_move_notification(args)
|
||||||
|
|
||||||
async def _finish_gcode_create_from_move(
|
async def _finish_gcode_create_from_move(self, file_path: str) -> None:
|
||||||
self, file_path: str, pending_node: Optional[InotifyNode]
|
|
||||||
) -> None:
|
|
||||||
mevt = self.parse_gcode_metadata(file_path)
|
mevt = self.parse_gcode_metadata(file_path)
|
||||||
await mevt.wait()
|
await mevt.wait()
|
||||||
args = ["create_file", "gcodes", file_path]
|
self.notify_filelist_changed("create_file", "gcodes", file_path)
|
||||||
if pending_node is None:
|
|
||||||
self.notify_filelist_changed(*args)
|
|
||||||
else:
|
|
||||||
pending_node.queue_move_notification(args)
|
|
||||||
|
|
||||||
def queue_gcode_notificaton(self, coro: Coroutine) -> None:
|
def queue_gcode_notificaton(self, coro: Coroutine) -> None:
|
||||||
self.pending_gcode_notifications.append(coro)
|
self.pending_gcode_notifications.append(coro)
|
||||||
|
|
Loading…
Reference in New Issue