feat: add runner failover policies and traces

This commit is contained in:
2026-05-12 02:16:42 +08:00
parent be31923e74
commit 05632172d0
26 changed files with 2033 additions and 140 deletions
@@ -134,6 +134,28 @@ WHERE id = $1::uuid`, platformID, cooldownSeconds)
return err
}
func (s *Store) DemoteCandidatePlatformPriority(ctx context.Context, platformID string, demoteStep int) error {
if strings.TrimSpace(platformID) == "" {
return nil
}
if demoteStep <= 0 {
demoteStep = 100
}
_, err := s.pool.Exec(ctx, `
UPDATE integration_platforms target
SET dynamic_priority = GREATEST(
COALESCE(target.dynamic_priority, target.priority),
COALESCE((
SELECT MAX(COALESCE(peer.dynamic_priority, peer.priority))
FROM integration_platforms peer
WHERE peer.deleted_at IS NULL
), target.priority) + $2::int
),
updated_at = now()
WHERE target.id = $1::uuid`, platformID, demoteStep)
return err
}
func scanRuntimePolicySet(scanner runtimePolicyScanner) (RuntimePolicySet, error) {
var item RuntimePolicySet
var rateLimitPolicy []byte