MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / save_state

Function save_state

chirpstack/src/storage/metrics.rs:77–90  ·  view source on GitHub ↗
(name: &str, state: &str)

Source from the content-addressed store, hash-verified

75}
76
77pub 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
92pub async fn save(name: &str, record: &Record, aggregations: &[Aggregation]) -> Result<()> {
93 if record.metrics.is_empty() {

Callers 1

Calls 3

redis_keyFunction · 0.85
get_ttlFunction · 0.85
get_async_redis_connFunction · 0.85

Tested by

no test coverage detected