package handlers import "time" // Handler operation timeout categories. // // Use these constants instead of inline magic numbers in context.WithTimeout calls. // Choose the category that matches the operation's characteristics: // // - TimeoutFastLookup: simple reads, single-resource fetches, health checks // - TimeoutStandard: single-service writes, K8s ops, DNS record ops // - TimeoutHeavyWrite: multi-step writes with git operations // - TimeoutOrchestration: multi-service coordination (create project, deploy) // - TimeoutLongRunning: agent/command execution, async tasks const ( // TimeoutFastLookup is for simple reads and lookups (DB queries, K8s get/list, health checks). // 5 seconds. If a read takes longer, something is wrong. TimeoutFastLookup = 5 * time.Second // TimeoutLookup is for API lookups that may involve a remote call (Woodpecker list, template fetch). // 10 seconds. Slightly more headroom for external API calls. TimeoutLookup = 10 * time.Second // TimeoutStandard is for single-service write operations (K8s apply, DNS create, git push). // 30 seconds. Most write operations complete well within this. TimeoutStandard = 30 * time.Second // TimeoutHeavyWrite is for multi-step write operations (component add with git clone + template + push). // 60 seconds. Git operations over network can be slow. TimeoutHeavyWrite = 60 * time.Second // TimeoutOrchestration is for operations that coordinate multiple services sequentially // (project creation: repo + DNS + template + CI activation). // 90 seconds. Longest synchronous handler operation. TimeoutOrchestration = 90 * time.Second // TimeoutLongRunning is for agent/command execution that streams output. // 10 minutes. Claude Code commands can run extended operations. TimeoutLongRunning = 10 * time.Minute )