fix redis key inconsistancy

This commit is contained in:
Zomatree
2024-04-24 02:29:31 +01:00
parent 67569f932e
commit 675c7d6c0d
2 changed files with 11 additions and 11 deletions

View File

@@ -580,10 +580,10 @@ impl State {
for id in members {
let unique_key = format!("{channel_or_server_id}-{id}");
let (audio, deafened, screensharing, camera) = conn
let (can_publish, can_receive, screensharing, camera) = conn
.mget::<_, (bool, bool, bool, bool)>(&[
format!("audio-{unique_key}"),
format!("deafened-{unique_key}"),
format!("can_publish-{unique_key}"),
format!("can_receive-{unique_key}"),
format!("screensharing-{unique_key}"),
format!("camera-{unique_key}"),
])
@@ -592,8 +592,8 @@ impl State {
let voice_state = v0::UserVoiceState {
id,
can_receive: audio,
can_publish: deafened,
can_receive,
can_publish,
screensharing,
camera,
};

View File

@@ -60,8 +60,8 @@ async fn ingress(db: &State<Database>, body: Json<WebhookEvent>) -> Result<Empty
Pipeline::new()
.sadd(format!("vc-members-{channel_id}"), user_id)
.set(format!("vc-{unique_key}"), channel_id)
.set(format!("publish-{unique_key}"), true)
.set(format!("subscribe-{unique_key}"), false)
.set(format!("can_publish-{unique_key}"), true)
.set(format!("can_receive-{unique_key}"), true)
.set(format!("screensharing-{unique_key}"), false)
.set(format!("camera-{unique_key}"), false)
.query_async(&mut conn.into_inner())
@@ -70,7 +70,7 @@ async fn ingress(db: &State<Database>, body: Json<WebhookEvent>) -> Result<Empty
let voice_state = UserVoiceState {
id: user_id.clone(),
can_receive: false,
can_receive: true,
can_publish: false,
screensharing: false,
camera: false,
@@ -102,8 +102,8 @@ async fn ingress(db: &State<Database>, body: Json<WebhookEvent>) -> Result<Empty
conn.del::<_, Vec<u64>>(&[
format!("vc-{unique_key}"),
format!("audio-{unique_key}"),
format!("deafened-{unique_key}"),
format!("can_publish-{unique_key}"),
format!("can_receive-{unique_key}"),
format!("screensharing-{unique_key}"),
format!("camera-{unique_key}"),
])
@@ -156,7 +156,7 @@ async fn ingress(db: &State<Database>, body: Json<WebhookEvent>) -> Result<Empty
}
/* TrackSource::Microphone */
2 => {
conn.set::<_, _, String>(format!("audio-{unique_key}"), value)
conn.set::<_, _, String>(format!("can_receive-{unique_key}"), value)
.await
.to_internal_error()?;