kick forever
CI/CD / test_and_check_app (push) Successful in 2m19s
CI/CD / Publish immutable image (push) Successful in 1m16s

This commit is contained in:
2026-09-24 14:38:18 +02:00
parent b190ff719e
commit 4dfe79ce5c
22 changed files with 271 additions and 113 deletions
@@ -80,7 +80,6 @@ class RoomParticipationService
} else {
$player->update([
'last_seen_at' => now(),
'inactive_at' => null,
]);
}
@@ -150,16 +149,13 @@ class RoomParticipationService
]);
$change = RoomStateChange::PlayerJoined;
} else {
if ($player->inactive_at !== null) {
$change = RoomStateChange::PlayerJoined;
} elseif ($player->name !== $playerName) {
if ($player->name !== $playerName) {
$change = RoomStateChange::PlayerUpdated;
}
$updates = [
'name' => $playerName,
'last_seen_at' => now(),
'inactive_at' => null,
];
if (
@@ -282,14 +278,14 @@ class RoomParticipationService
?User $user,
?Player $currentPlayer,
): void {
$stateVersion = DB::transaction(function () use ($room, $player, $user, $currentPlayer): ?int {
$stateVersion = DB::transaction(function () use ($room, $player, $user, $currentPlayer): int {
$lockedRoom = Room::query()
->lockForUpdate()
->findOrFail($room->id);
$lockedCurrentPlayer = $currentPlayer === null
? null
: $lockedRoom->activePlayers()
: $lockedRoom->players()
->lockForUpdate()
->find($currentPlayer->id);
$isOwner = $user !== null && $lockedRoom->owner_id === $user->id;
@@ -312,13 +308,7 @@ class RoomParticipationService
403,
);
if ($lockedPlayer->inactive_at !== null) {
return null;
}
$lockedPlayer->update([
'inactive_at' => now(),
]);
$lockedPlayer->delete();
$lockedRoom->update([
'last_activity_at' => now(),
'state_version' => $lockedRoom->state_version + 1,
@@ -327,10 +317,6 @@ class RoomParticipationService
return $lockedRoom->state_version;
});
if ($stateVersion === null) {
return;
}
RoomStateChanged::dispatch(
$room->id,
$stateVersion,