From e9a115c315e7db4ed9c28cd38812d4bdd750b2ea Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 18 Sep 2026 15:01:46 +0000 Subject: [PATCH] player-counter: stop logging failed queries as application errors Every query schema called report(\$exception) whenever a query attempt failed, which fires on any restart, boot-up window, or brief network hiccup - not just genuine bugs. With the players widget polling every 30s, this spammed the log on something completely routine: the queried server (or proxy) not answering yet. The UI already reflects an unreachable server as offline/unknown without needing a log entry for it. Drop the report() calls in all six query schemas (Java query+ping, Bedrock, Source/GoldSource, CitizenFX, Palworld); the proxy schema inherits the Java ones, so this covers it too. The exceptions are still caught and swallowed exactly as before, just without logging. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01SA9aNschKoWLmWkWNC2fGZ --- .../Query/Schemas/CitizenFXQueryTypeSchema.php | 5 +++-- .../Query/Schemas/MinecraftBedrockQueryTypeSchema.php | 5 +++-- .../Query/Schemas/MinecraftJavaQueryTypeSchema.php | 10 ++++++---- .../Query/Schemas/PalworldQueryTypeSchema.php | 6 +++--- .../Extensions/Query/Schemas/SourceQueryTypeSchema.php | 5 +++-- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/player-counter/src/Extensions/Query/Schemas/CitizenFXQueryTypeSchema.php b/player-counter/src/Extensions/Query/Schemas/CitizenFXQueryTypeSchema.php index 63828d52..d2f2c5fd 100644 --- a/player-counter/src/Extensions/Query/Schemas/CitizenFXQueryTypeSchema.php +++ b/player-counter/src/Extensions/Query/Schemas/CitizenFXQueryTypeSchema.php @@ -44,8 +44,9 @@ public function process(Server $server, string $ip, int $port): ?array 'max_players' => $info['sv_maxclients'], 'players' => array_map(fn ($player) => ['id' => (string) $player['id'], 'name' => (string) $player['name']], $players), ]; - } catch (Exception $exception) { - report($exception); + } catch (Exception) { + // Not reported: a failed query almost always just means the server is offline, + // starting or otherwise unreachable, not an application error. } return null; diff --git a/player-counter/src/Extensions/Query/Schemas/MinecraftBedrockQueryTypeSchema.php b/player-counter/src/Extensions/Query/Schemas/MinecraftBedrockQueryTypeSchema.php index 946dcdf5..43d7226c 100644 --- a/player-counter/src/Extensions/Query/Schemas/MinecraftBedrockQueryTypeSchema.php +++ b/player-counter/src/Extensions/Query/Schemas/MinecraftBedrockQueryTypeSchema.php @@ -40,8 +40,9 @@ public function process(Server $server, string $ip, int $port): ?array 'max_players' => $info['MaxPlayers'], 'players' => null, // Bedrock has no player list ]; - } catch (Exception $exception) { - report($exception); + } catch (Exception) { + // Not reported: a failed query almost always just means the server is offline, + // starting or otherwise unreachable, not an application error. } return null; diff --git a/player-counter/src/Extensions/Query/Schemas/MinecraftJavaQueryTypeSchema.php b/player-counter/src/Extensions/Query/Schemas/MinecraftJavaQueryTypeSchema.php index ea4d6857..a353915f 100644 --- a/player-counter/src/Extensions/Query/Schemas/MinecraftJavaQueryTypeSchema.php +++ b/player-counter/src/Extensions/Query/Schemas/MinecraftJavaQueryTypeSchema.php @@ -58,8 +58,10 @@ protected function tryQuery(string $ip, int $port): false|array 'max_players' => $info['MaxPlayers'], 'players' => array_map(fn ($player) => ['id' => (string) $player, 'name' => (string) $player], $players), ]; - } catch (Exception $exception) { - report($exception); + } catch (Exception) { + // Not reported: a failed query almost always just means the server is offline, + // starting or otherwise unreachable, not an application error. It falls back to + // tryPing() below, and the UI already reflects an unreachable server on its own. } return false; @@ -84,8 +86,8 @@ protected function tryPing(string $ip, int $port): false|array 'max_players' => $data['players']['max'], 'players' => $data['players']['sample'] ?? [], ]; - } catch (Exception $exception) { - report($exception); + } catch (Exception) { + // Not reported, see tryQuery() above - same reasoning applies to the ping fallback. } finally { if (isset($ping)) { $ping->Close(); diff --git a/player-counter/src/Extensions/Query/Schemas/PalworldQueryTypeSchema.php b/player-counter/src/Extensions/Query/Schemas/PalworldQueryTypeSchema.php index 97105f84..b55b8403 100644 --- a/player-counter/src/Extensions/Query/Schemas/PalworldQueryTypeSchema.php +++ b/player-counter/src/Extensions/Query/Schemas/PalworldQueryTypeSchema.php @@ -50,9 +50,9 @@ public function process(Server $server, string $ip, int $port): ?array 'players' => array_map(fn ($player) => ['id' => (string) ($player['playerId'] ?? $player['userId']), 'name' => (string) $player['name']], $players), ]; - } catch (Exception $exception) { - report($exception); - + } catch (Exception) { + // Not reported: a failed query almost always just means the server is offline, + // starting or otherwise unreachable, not an application error. return null; } } diff --git a/player-counter/src/Extensions/Query/Schemas/SourceQueryTypeSchema.php b/player-counter/src/Extensions/Query/Schemas/SourceQueryTypeSchema.php index 5d4902fd..8d95586c 100644 --- a/player-counter/src/Extensions/Query/Schemas/SourceQueryTypeSchema.php +++ b/player-counter/src/Extensions/Query/Schemas/SourceQueryTypeSchema.php @@ -43,8 +43,9 @@ protected function run(string $ip, int $port, int $engine): ?array 'max_players' => $info['MaxPlayers'], 'players' => array_map(fn ($player) => ['id' => (string) $player['Id'], 'name' => (string) $player['Name']], $players), ]; - } catch (Exception $exception) { - report($exception); + } catch (Exception) { + // Not reported: a failed query almost always just means the server is offline, + // starting or otherwise unreachable, not an application error. } finally { $query->Disconnect(); }