Implement redis store for circuitbox
By default, the circuit breaker is using a memory store to track the state of the circuit. This is okay for a single node environment since threads can share the store. On production though, we have multiple nodes (puma and sidekiq) so a need for a persisted store is required. This adds a custom store that will utilize redis as the storage. It uses the redis-ratelimiting DB for this since it's kind of related with rate limiting. The `Gitlab::CircuitBreaker::Store` is based on Circuitbox's memory store (https://github.com/yammer/circuitbox/blob/main/lib/circuitbox/memory_store.rb) but modified to use redis. This is behind the `circuit_breaker` feature flag.
显示
- Gemfile 1 个添加, 1 个删除Gemfile
- Gemfile.checksum 1 个添加, 1 个删除Gemfile.checksum
- Gemfile.lock 2 个添加, 2 个删除Gemfile.lock
- config/circuitbox.rb 0 个添加, 6 个删除config/circuitbox.rb
- config/initializers/circuitbox.rb 8 个添加, 0 个删除config/initializers/circuitbox.rb
- ee/lib/gitlab/circuit_breaker/notifier.rb 4 个添加, 2 个删除ee/lib/gitlab/circuit_breaker/notifier.rb
- ee/lib/gitlab/circuit_breaker/store.rb 57 个添加, 0 个删除ee/lib/gitlab/circuit_breaker/store.rb
- ee/spec/lib/gitlab/circuit_breaker/store_spec.rb 201 个添加, 0 个删除ee/spec/lib/gitlab/circuit_breaker/store_spec.rb
- ee/spec/lib/gitlab/llm/concerns/circuit_breaker_spec.rb 55 个添加, 1 个删除ee/spec/lib/gitlab/llm/concerns/circuit_breaker_spec.rb
- spec/initializers/circuitbox_spec.rb 15 个添加, 0 个删除spec/initializers/circuitbox_spec.rb
加载中
想要评论请 注册 或 登录