chore (backend-rs): address nightly clippy warnings
This commit is contained in:
parent
dc2b452e5a
commit
27f2a6b080
3 changed files with 9 additions and 14 deletions
5
packages/backend-rs/src/cache/redis.rs
vendored
5
packages/backend-rs/src/cache/redis.rs
vendored
|
@ -86,15 +86,14 @@ pub async fn set<V: for<'a> Deserialize<'a> + Serialize>(
|
|||
value: &V,
|
||||
ttl: Duration,
|
||||
) -> Result<(), Error> {
|
||||
redis_conn()
|
||||
Ok(redis_conn()
|
||||
.await?
|
||||
.set_ex(
|
||||
prefix_key(key),
|
||||
rmp_serde::encode::to_vec(&value)?,
|
||||
ttl.num_seconds().try_into().map_err(|_| Error::TTL)?,
|
||||
)
|
||||
.await?;
|
||||
Ok(())
|
||||
.await?)
|
||||
}
|
||||
|
||||
/// Gets a Redis cache.
|
||||
|
|
|
@ -60,8 +60,11 @@ pub async fn update_antennas_on_new_note(
|
|||
}
|
||||
|
||||
async fn add_note_to_antenna(antenna_id: &str, note: &Note) -> Result<(), Error> {
|
||||
// for streaming API
|
||||
stream::antenna::publish(antenna_id.to_owned(), note).await?;
|
||||
|
||||
// for timeline API
|
||||
redis_conn()
|
||||
Ok(redis_conn()
|
||||
.await?
|
||||
.xadd_maxlen(
|
||||
redis_key(format!("antennaTimeline:{}", antenna_id)),
|
||||
|
@ -69,10 +72,5 @@ async fn add_note_to_antenna(antenna_id: &str, note: &Note) -> Result<(), Error>
|
|||
format!("{}-*", get_timestamp(¬e.id)?),
|
||||
&[("note", ¬e.id)],
|
||||
)
|
||||
.await?;
|
||||
|
||||
// for streaming API
|
||||
stream::antenna::publish(antenna_id.to_owned(), note).await?;
|
||||
|
||||
Ok(())
|
||||
.await?)
|
||||
}
|
||||
|
|
|
@ -112,13 +112,11 @@ pub async fn publish_to_stream(
|
|||
value.ok_or(Error::InvalidContent)?
|
||||
};
|
||||
|
||||
redis_conn()
|
||||
Ok(redis_conn()
|
||||
.await?
|
||||
.publish(
|
||||
&CONFIG.host,
|
||||
format!("{{\"channel\":\"{}\",\"message\":{}}}", channel, message),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
.await?)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue