Skip to content

Commit

Permalink
fix(mm): clean up players from gc zset (#914)
Browse files Browse the repository at this point in the history
<!-- Please make sure there is an issue that this PR is correlated to. -->

## Changes

<!-- If there are frontend changes, please include screenshots. -->
  • Loading branch information
NathanFlurry committed Jun 16, 2024
1 parent 3b24383 commit d6d05f6
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 d6d05f6

Please sign in to comment.