更新异步等待

This commit is contained in:
sleikang
2024-11-10 12:29:31 +08:00
parent 6e2d381b5d
commit c99543c665

View File

@@ -4,7 +4,7 @@ import re
import shutil
import threading
import traceback
import time
import asyncio
from pathlib import Path
from typing import List, Tuple, Dict, Any, Optional
@@ -408,7 +408,7 @@ class FileSoftLink(_PluginBase):
event_path=str(src_file),
mon_path=mon_path,
)
time.sleep(self._sync_interval)
asyncio.sleep(self._sync_interval)
if event.event_data.get("user"):
self.post_message(
@@ -453,7 +453,7 @@ class FileSoftLink(_PluginBase):
self.__handle_file(
event_path=str(src_file), mon_path=mon_path
)
time.sleep(self._sync_interval)
asyncio.sleep(self._sync_interval)
if event.event_data.get("user"):
self.post_message(
channel=event.event_data.get("channel"),
@@ -475,7 +475,7 @@ class FileSoftLink(_PluginBase):
self.__handle_file(
event_path=str(src_file), mon_path=mon_path
)
time.sleep(self._sync_interval)
asyncio.sleep(self._sync_interval)
if event.event_data.get("user"):
self.post_message(
channel=event.event_data.get("channel"),
@@ -514,7 +514,7 @@ class FileSoftLink(_PluginBase):
src_file = os.path.join(sroot, file_name)
if Path(src_file).is_file():
self.__handle_file(event_path=str(src_file), mon_path=mon_path)
time.sleep(self._sync_interval)
asyncio.sleep(self._sync_interval)
if event.event_data.get("user"):
self.post_message(
channel=event.event_data.get("channel"),
@@ -552,7 +552,7 @@ class FileSoftLink(_PluginBase):
path = os.path.join(root, name)
if Path(path).is_file():
self.__handle_file(event_path=str(path), mon_path=mon_path)
time.sleep(self._sync_interval)
asyncio.sleep(self._sync_interval)
logger.info("全量同步监控目录完成!")
def event_handler(self, event, mon_path: str, text: str, event_path: str):