|
1 | 1 | use crate::store::core::RedisStore; |
2 | 2 | use alloy::primitives::Address; |
3 | 3 | use anyhow::{anyhow, Result}; |
4 | | -use log::error; |
| 4 | +use log::{error, info}; |
5 | 5 | use redis::AsyncCommands; |
6 | 6 | use shared::models::metric::MetricEntry; |
7 | 7 | use std::collections::HashMap; |
@@ -30,6 +30,7 @@ impl MetricsStore { |
30 | 30 | // Check if the new node-centric key already exists |
31 | 31 | let exists: bool = con.exists(&new_key).await?; |
32 | 32 | if exists { |
| 33 | + info!("Migration already complete for this node: {}", node_address); |
33 | 34 | // Migration already complete for this node |
34 | 35 | return Ok(()); |
35 | 36 | } |
@@ -83,12 +84,13 @@ impl MetricsStore { |
83 | 84 | } |
84 | 85 |
|
85 | 86 | pipe.query_async::<()>(&mut con).await?; |
86 | | - } else { |
87 | | - // Even if no metrics exist, create an empty key to mark migration as complete |
88 | | - let _: () = con.hset(&new_key, "_migrated", "true").await?; |
89 | | - let _: () = con.hdel(&new_key, "_migrated").await?; |
90 | 87 | } |
91 | 88 |
|
| 89 | + // Always create the key to mark migration as complete, even if no metrics exist |
| 90 | + // This prevents future migration attempts for nodes without data |
| 91 | + let _: () = con.hset(&new_key, "_migrated", "true").await?; |
| 92 | + let _: () = con.hdel(&new_key, "_migrated").await?; |
| 93 | + |
92 | 94 | Ok(()) |
93 | 95 | } |
94 | 96 |
|
|
0 commit comments