refactor: 复用持久设备工作线程 (#110)

This commit is contained in:
chengma
2026-08-10 18:00:38 +08:00
parent 553659208a
commit 70cedc34d4
11 changed files with 563 additions and 149 deletions
+5 -2
View File
@@ -13,7 +13,10 @@ from .admin_gateway import (
ClientInfo,
)
from .pdd_collect_service import PddCollectError, PddCollectService
from .pdd_device_service import PddDeviceService
from .pdd_device_service import (
PddDeviceService,
current_thread_device_service,
)
from .db import data_dir
from .task_models import OutboxEventRecord, OutboxEventType, TaskStatus, TaskType
from .task_models import NewClaimedTask
@@ -258,7 +261,7 @@ class CollectTaskService:
cancelled: Callable[[], bool],
) -> PddCollectService:
return PddCollectService(
PddDeviceService(),
current_thread_device_service() or PddDeviceService(),
device_address,
client_id,
cancelled=cancelled,