Skip to content

feat(client): add caching for GetSeats API to reduce rate limit errors#2

Merged
hystking merged 4 commits intomainfrom
feat/seats-cache
Dec 18, 2025
Merged

feat(client): add caching for GetSeats API to reduce rate limit errors#2
hystking merged 4 commits intomainfrom
feat/seats-cache

Conversation

@hystking
Copy link
Copy Markdown
Owner

Summary

  • Add in-memory cache for /seats/ API responses within the Client struct
  • Cache is thread-safe using sync.RWMutex with double-checked locking pattern
  • Cache is automatically invalidated after AssignSeat() or UnassignSeat() operations
  • Reduces API calls during terraform apply to avoid rate limit errors

Test plan

  • Run make build to verify compilation
  • Run terraform apply with multiple coderabbit_seats resources and confirm /seats/ API is called only once
  • Verify seat assignment/unassignment still works correctly (cache invalidation)

Cache the /seats/ API response for the lifetime of the client instance,
avoiding redundant API calls during a single terraform apply run.
Cache is automatically invalidated after AssignSeat/UnassignSeat operations.
@hystking hystking merged commit 50cb74e into main Dec 18, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant