Skip to content

Commit

Permalink
Temp fix for add_counter on InMem store
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsnaps committed Mar 14, 2024
1 parent 98d6b4f commit d00d91f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions limitador/src/storage/redis/redis_lenient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ impl AsyncCounterStorage for RedisLenient {
counter_access: CounterAccess<'a>,
) -> Result<Authorization, StorageErr> {
if self.is_partitioned() {
let _ = self.fallback.add_counter(counters[0].limit()).unwrap();
self.fallback
.check_and_update(counters, delta, load_counters)
} else {
Expand All @@ -71,6 +72,7 @@ impl AsyncCounterStorage for RedisLenient {
.or_else(|err| {
if err.is_transient() {
self.partitioned(true);
let _ = self.fallback.add_counter(counters[0].limit()).unwrap();
self.fallback
.check_and_update(counters, delta, load_counters)
} else {
Expand Down Expand Up @@ -147,6 +149,7 @@ impl RedisLenient {
interval.tick().await;
if self.is_partitioned() {
let partitioned = !self.redis.is_alive().await;
println!("Partitioned! Testing… Fine? {}", !partitioned);
self.partitioned(partitioned);
}
}
Expand Down

0 comments on commit d00d91f

Please sign in to comment.