Skip to content

Commit eaf77fc

Browse files
committed
fix(mm): clean up players from gc zset
1 parent 6294a8b commit eaf77fc

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

svc/pkg/mm/worker/src/workers/player_remove.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,23 @@ async fn worker(ctx: &OperationContext<mm::msg::player_remove::Message>) -> Glob
8383
tracing::error!("discarding stale message");
8484
return Ok(());
8585
} else {
86-
retry_bail!("player not found, may be race condition with insertion");
86+
// Delete what we can. Remove from GC so this message doesn't get published again.
87+
tracing::warn!(
88+
?player_id,
89+
"player not found in sql or redis, cleaning up & discarding message"
90+
);
91+
let player_id_str = player_id.to_string();
92+
redis::pipe()
93+
.del(util_mm::key::player_config(player_id))
94+
.ignore()
95+
.zrem(util_mm::key::player_unregistered(), &player_id_str)
96+
.ignore()
97+
.zrem(util_mm::key::player_auto_remove(), &player_id_str)
98+
.ignore()
99+
.query_async(&mut ctx.redis_mm().await?)
100+
.await?;
101+
102+
return Ok(());
87103
};
88104

89105
// Validate lobby

0 commit comments

Comments
 (0)