Skip to content

perf(submit): read report-form server names from the query cache - #1619

Closed
NopeCharon wants to merge 1 commit into
sbpp:mainfrom
NopeCharon:fix/1611-report-server-cache
Closed

NopeCharon wants to merge 1 commit into
sbpp:mainfrom
NopeCharon:fix/1611-report-server-cache

Conversation

@NopeCharon

Copy link
Copy Markdown
Contributor

Description

The public "Report a player" form (page.submit.php) now gets server hostnames for its server <select> from Sbpp\Servers\SourceQueryCache. Before, it opened a fresh A2S socket to every enabled server on every render.

That's the same per-(ip, port) on-disk cache (30s window) the public servers page already fills:

  • A visitor arriving from the servers list hits a warm cache.
  • Repeat loads inside the window send no probes.
  • Unreachable servers are negatively cached, so an offline server costs one timeout per window instead of one per page view.

The submit path, which looks up the chosen server's name for the notification email, uses the same cache. I also updated the SubmitBanView docblock, the cache section in ARCHITECTURE.md, and the matching AGENTS.md "Where to find what" row.

Motivation and Context

Fixes #1611. With 20+ servers the form took 5-10 seconds to load.

Because the page is anonymous, every reload also fanned an uncached UDP probe out to every configured game server. #1311 removed that amplification from the servers page; this removes it from the report form.

One trade-off: on a fully cold cache, a reachable server now gets GetInfo + GetPlayers (the cache's payload) instead of GetInfo only. That only happens once per window, and it warms the servers page too.

How Has This Been Tested?

  • New web/tests/integration/SubmitBanServerListCacheTest.php. It renders page.submit.php in a separate process against the cache's probe override and checks three cases:
    • A warm cache is reused with zero probes.
    • A cold cache probes each server once, and a reload adds none.
    • An unreachable server keeps the Error Connecting (ip:port) label.
  • On main, the first two tests fail and the third passes, as expected.
  • End to end: I installed a panel (PHP 8.5, MariaDB 10.11, php -S) with five servers on unreachable TEST-NET addresses and timed GET ?p=submit.
    • With this branch: 6.7s cold, then 0.01s and 0.01s.
    • On main: 5.5s, 5.0s, 5.0s on every load.
  • PHPStan (with phpstan-dba against a live schema): no errors.
  • Full PHPUnit suite: everything passes except three failures that also happen on main in my container. Two are ExportBundleWriterTest (no ext-zip in my image), and one was the PluginVersionResolveTest describe test fixed by Make PluginVersionResolveTest git-describe tests independent of checkout tag #1615.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.

…p#1611)

The public "Report a player" form labelled its server <select> by
opening a fresh A2S socket to every enabled server on every render
(Connect + GetInfo, 1s timeout each). On panels with 20+ servers the
page took 5-10 seconds to load. Because the page is anonymous, every
reload also fanned an uncached UDP probe out to every game server,
the same amplification shape sbpp#1311 closed on the servers page.

Read the hostnames through Sbpp\Servers\SourceQueryCache instead, the
per-(ip, port) on-disk cache the public servers page already fills.
A visitor coming from the servers list hits a warm cache, and repeat
loads inside the 30s window issue no probes at all. Unreachable
servers are negatively cached, so an offline server costs one timeout
per window instead of one per page view. The submit path, which looks
up the chosen server's name for the notification email, uses the same
cache.

SubmitBanServerListCacheTest renders page.submit.php against the
cache's probe override: a warm cache is reused with zero probes, a
cold cache probes each server once and a reload coalesces, and an
unreachable server keeps the "Error Connecting (ip:port)" label.
ARCHITECTURE.md and AGENTS.md list the form as a cache consumer.
@NopeCharon
NopeCharon requested a review from a team November 4, 2026 07:55
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

Thanks for the PR! This change touches web/** (the SourceBans++ web panel),
which is covered by the project's Contributor License Agreement.

To sign, comment exactly the following line on this PR:

I have read the CLA Document and I hereby sign the CLA

You only need to sign once — your signature applies to every future
web-panel PR you open against this repo. Plugin-only PRs
(game/addons/sourcemod/**) don't need a signature.

See CONTRIBUTING.md
for the rationale.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@rumblefrog

Copy link
Copy Markdown
Member

Spam bot

@rumblefrog rumblefrog closed this Nov 7, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Leverage server cache on "Report a player page"

2 participants