From cc86827b3e6fe9d509072cab4651d99e36093cb2 Mon Sep 17 00:00:00 2001 From: Alex Snaps Date: Wed, 27 Mar 2024 09:38:32 -0400 Subject: [PATCH] Added logging on partition --- limitador/src/storage/redis/redis_cached.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/limitador/src/storage/redis/redis_cached.rs b/limitador/src/storage/redis/redis_cached.rs index 304b1e08..bf3e4afb 100644 --- a/limitador/src/storage/redis/redis_cached.rs +++ b/limitador/src/storage/redis/redis_cached.rs @@ -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. // @@ -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 { @@ -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()