(name: &str, state: &str)
| 75 | } |
| 76 | |
| 77 | pub async fn save_state(name: &str, state: &str) -> Result<()> { |
| 78 | let key = redis_key(format!("metrics:{{{}}}", name)); |
| 79 | let ttl = get_ttl(Aggregation::MONTH); |
| 80 | |
| 81 | () = redis::cmd("PSETEX") |
| 82 | .arg(key) |
| 83 | .arg(ttl.as_millis() as usize) |
| 84 | .arg(state) |
| 85 | .query_async(&mut get_async_redis_conn().await?) |
| 86 | .await?; |
| 87 | |
| 88 | info!(state = %state, "State saved"); |
| 89 | Ok(()) |
| 90 | } |
| 91 | |
| 92 | pub async fn save(name: &str, record: &Record, aggregations: &[Aggregation]) -> Result<()> { |
| 93 | if record.metrics.is_empty() { |
no test coverage detected