]> git.ipfire.org Git - thirdparty/public-inbox.git/commit
limiter: refactor to reduce code duplication
authorEric Wong <e@80x24.org>
Fri, 21 Mar 2025 22:22:30 +0000 (22:22 +0000)
committerEric Wong <e@80x24.org>
Sun, 23 Mar 2025 22:05:44 +0000 (22:05 +0000)
commit4ed6b51f693657bccb78731fcf710e7494836bcf
tree4f1f8ad9a176e76636895d5fb6318e031829c535
parent153173691b11bc7e5877a39889f150b6b2d25278
limiter: refactor to reduce code duplication

PlackLimiter, Qspawn, and ViewVCS all have roughly the same
code around our base Limiter package, so put everything around
a new Limiter->may_start subroutine.  PlackLimiter loses some
stats as a result but that's logged anyways and I doubt the
customizable error message was worth the effort.

We now have ckhup and 499 (client disconnect) handling for all
PSGI uses of Limiter, as well.

t/qspawn.t changes were required since the original ->finalize
logic now relies on on_destroy; but none of the existing PSGI
code using Qspawn required changes.
lib/PublicInbox/Limiter.pm
lib/PublicInbox/PlackLimiter.pm
lib/PublicInbox/Qspawn.pm
lib/PublicInbox/ViewVCS.pm
t/qspawn.t