Marvin Zhang
851097dc59
fix(node/service): implement worker client wrapper using local TaskServiceServer
...
Implement createWorkerClient to return a workerTaskClient when a node has an active gRPC stream.
Add workerTaskClient that wraps the server.TaskServiceServer, stubs other client RPCs and forwards
CheckProcess calls directly to server.CheckProcess for querying worker process status.
2025-10-27 16:26:32 +08:00
Marvin Zhang
49165b2165
refactor(node): reorganize task reconciliation, prioritize worker cache, add periodic cleanup
...
- Move and document reconciliation constants and add sectioned organization/comments.
- Split large monolithic logic into smaller functions:
- reconcileDisconnectedTasks / reconcileDisconnectedTask
- reconcileAbandonedAssignedTasks
- reconcileStalePendingTasks / handleStalePendingTask
- getActualTaskStatus / getStatusFromWorkerCache / triggerWorkerStatusSync
- queryProcessStatus / requestProcessStatusFromWorker / mapProcessStatusToTaskStatus
- findTasksByStatus / markTaskDisconnected / findAvailableNodeForTask
- updateTaskStatus / saveTask / shouldMarkTaskAbnormal / markTaskAbnormal
- Add periodic background workers:
- StartPeriodicReconciliation -> runPeriodicReconciliation to reconcile running/disconnected tasks
- runPeriodicAssignedTaskCleanup -> cleanupStuckAssignedTasks to detect and recover stuck assigned tasks
- Prioritize worker-side cached status and attempt sync from task runner before querying worker processes.
- Introduce a placeholder createWorkerClient for future gRPC worker discovery/invocation.
- Replace ad-hoc DB updates with saveTask using retry/backoff and centralize status update logic.
- Improve logging and error messages, and tighten conditions for marking tasks abnormal.
This refactor clarifies responsibilities, improves reliability of status updates, and prepares the codebase for future worker gRPC integration.
2025-10-20 10:54:32 +08:00
Marvin Zhang
29ef8d67da
feat: implement synchronization and error handling improvements in task reconciliation and file synchronization
2025-09-28 17:42:23 +08:00
Marvin Zhang
afa5fab4c1
feat: enhance task reconciliation with worker-side status caching and synchronization
2025-09-17 11:03:35 +08:00
Marvin Zhang
8c2c23d9b6
feat: Update gRPC service definitions and implement CheckProcess method
...
- Downgraded protoc-gen-go-grpc and protoc versions for compatibility.
- Added CheckProcess method to TaskService with corresponding request and response types.
- Updated Subscribe and Connect methods to use new generic client stream types.
- Refactored server and client implementations for Subscribe and Connect methods.
- Ensured backward compatibility by maintaining existing method signatures where applicable.
- Added necessary handler for CheckProcess in the service descriptor.
2025-09-17 10:37:03 +08:00
Marvin Zhang
c6834e9964
feat: enhance task reconciliation logic with improved status handling and error messaging
2025-09-17 10:18:13 +08:00
Marvin Zhang
60be5072e5
feat: add node disconnection handling and update task statuses accordingly
2025-09-12 15:40:29 +08:00