Skip to content

Commit

Permalink
Added logging on partition
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsnaps committed Apr 2, 2024
1 parent 3f5deb8 commit cc86827
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions limitador/src/storage/redis/redis_cached.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use std::str::FromStr;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex, MutexGuard};
use std::time::{Duration, Instant};
use tracing::{error, warn};

// This is just a first version.
//
Expand Down Expand Up @@ -259,6 +260,7 @@ impl CachedRedisStorage {
loop {
if p.load(Ordering::Acquire) {
if storage.is_alive().await {
warn!("Partition to Redis resolved!");
p.store(false, Ordering::Release);
}
} else {
Expand Down Expand Up @@ -307,6 +309,9 @@ impl CachedRedisStorage {
}

fn partitioned(&self, partition: bool) -> bool {
if partition {
error!("Partition to Redis detected!")
}
self.partitioned
.compare_exchange(!partition, partition, Ordering::Release, Ordering::Acquire)
.is_ok()
Expand Down

0 comments on commit cc86827

Please sign in to comment.