feat: Task Health Check + customer_number in webhook payload
- Task model: CustomerNumber field (K-Nummer aus customers.number)
- DB: taskSelectCols joined c.number, scanTask scans CustomerNumber
- Hub: WaitForAgentOnline() polls until agent reconnects or timeout
- Scheduler: executeUpdateWithHealthCheck() waits for agent reconnect after update
- health_check: {agent_online: bool, checked_at: RFC3339} in result
- Status: completed_with_warning wenn Update OK aber Agent offline bleibt
- Frontend: Task-Tabelle zeigt Status-Badge (lauft/fehler/warnung/abgebr.)
This commit is contained in:
@@ -175,6 +175,19 @@ func (h *Hub) IsAgentConnected(agentID string) bool {
|
||||
return exists
|
||||
}
|
||||
|
||||
// WaitForAgentOnline polls until the agent reconnects or timeout is reached.
|
||||
// Returns true if agent came online within the timeout, false otherwise.
|
||||
func (h *Hub) WaitForAgentOnline(agentID string, timeout time.Duration) bool {
|
||||
deadline := time.Now().Add(timeout)
|
||||
for time.Now().Before(deadline) {
|
||||
if h.IsAgentConnected(agentID) {
|
||||
return true
|
||||
}
|
||||
time.Sleep(10 * time.Second)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (h *Hub) GetConnectedAgents() []string {
|
||||
h.agentsMux.RLock()
|
||||
defer h.agentsMux.RUnlock()
|
||||
|
||||
Reference in New Issue
Block a user