Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions internal/sdkclient/sdkclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,22 @@ type HookdeckRateLimiter struct {
// on these headers, but they're available for debugging and future enhancements.
//
// Retry Considerations:
// - We intentionally DO NOT implement automatic retries on 429 errors
// - Retries would consume additional tokens from our rate limit bucket,
// potentially causing cascading failures for subsequent requests
// - If retry logic is needed, implement using recursion with retry count tracking,
// ensuring each retry attempt goes through the rate limiter to maintain
// the global rate limit invariant
// - We intentionally DO NOT implement automatic retries on 429 errors
// - Retries would consume additional tokens from our rate limit bucket,
// potentially causing cascading failures for subsequent requests
// - If retry logic is needed, implement using recursion with retry count tracking,
// ensuring each retry attempt goes through the rate limiter to maintain
// the global rate limit invariant
//
// Performance Trade-offs:
// - This rate limiter works well for large Terraform states (200+ resources)
// - However, it significantly impacts small deployments:
// - 100 resources now take ~30 seconds vs ~5 seconds previously
// - This is an intentional trade-off for reliability and compliance
// - Future optimization could implement a true "240 requests per sliding minute"
// window instead of the current token bucket approach
// - Potential solution: In-memory FIFO queue that tracks the last minute's
// requests and blocks when 240 requests have been made in the past 60 seconds
// - Future optimization could implement a true "240 requests per sliding minute"
// window instead of the current token bucket approach
// - Potential solution: In-memory FIFO queue that tracks the last minute's
// requests and blocks when 240 requests have been made in the past 60 seconds
func NewHookdeckRateLimiter() *HookdeckRateLimiter {
// API limit: 240 requests per minute
// We use 230 req/min with burst of 5 to stay safely under the limit
Expand Down