Skip to content

Commit

Permalink
fix(mm): clean up players from gc zset
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFlurry committed Jun 14, 2024
1 parent 6294a8b commit eaf77fc
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion svc/pkg/mm/worker/src/workers/player_remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,23 @@ async fn worker(ctx: &OperationContext<mm::msg::player_remove::Message>) -> Glob
tracing::error!("discarding stale message");
return Ok(());
} else {
retry_bail!("player not found, may be race condition with insertion");
// Delete what we can. Remove from GC so this message doesn't get published again.
tracing::warn!(
?player_id,
"player not found in sql or redis, cleaning up & discarding message"
);
let player_id_str = player_id.to_string();
redis::pipe()
.del(util_mm::key::player_config(player_id))
.ignore()
.zrem(util_mm::key::player_unregistered(), &player_id_str)
.ignore()
.zrem(util_mm::key::player_auto_remove(), &player_id_str)
.ignore()
.query_async(&mut ctx.redis_mm().await?)
.await?;

return Ok(());
};

// Validate lobby
Expand Down

0 comments on commit eaf77fc

Please sign in to comment.