Tried adjusting the playerdata lock

changed online-player endpoint return type to json from plain html
This commit is contained in:
Vari 2024-08-31 04:55:01 +02:00
parent a493f076ab
commit 6d5698f10e
2 changed files with 3 additions and 2 deletions

View File

@ -9,6 +9,7 @@
use App\Models\Game\Matchmaking\QueuedPlayer;
use DB;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Response;
class StatisticsController extends Controller
{
@ -20,7 +21,7 @@ public function getOnlinePlayers() {
$queuedRunners = QueuedPlayer::whereSide(MatchmakingSide::Runner)->count();
$inGamePlayers = DB::table('game_user')->count();
return json_encode(new OnlinePlayersResponse(
return Response::json(new OnlinePlayersResponse(
$queuedRunners,
$queuedHunters,
$inGamePlayers,

View File

@ -41,7 +41,7 @@ public function playerData(): PlayerData|Model
{
// Shared Lock alone didn't prevent sometimes duplicate playerData entries.
// Hopefully this lock will work.
$lock = Cache::lock(static::PLAYER_DATA_LOCK, 5);
$lock = Cache::lock(static::PLAYER_DATA_LOCK . $this->id, 5);
try {
$lock->block(5);