Files
Agent-System/internal/taskrun/worker.go
T
weichenandCursor 3ade654256 feat(taskrun): add worker lease/heartbeat and Phase 5 fault injection tests
Introduce goose v20 lease columns with heartbeat loops so only expired
leases are marked interrupted on restart; add PG tests for concurrent
stage advance, active lease survival, and backup migration idempotency.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00

21 lines
330 B
Go

package taskrun
import (
"fmt"
"os"
"time"
)
const (
defaultLeaseTTL = 30 * time.Second
defaultHeartbeatPeriod = 10 * time.Second
)
func newWorkerID() string {
host, err := os.Hostname()
if err != nil || host == "" {
host = "local"
}
return fmt.Sprintf("%s-%d-%d", host, os.Getpid(), time.Now().UnixNano())
}