fix(porch-store): log a genuine pool_count trap, not just 503 silently

- catch (e) nil could not distinguish a real store failure (e.g. a
  mod-by-zero from Pool { actors: [] }) from ordinary saturation
- print_err the trap message before answering 503, matching the same
  fix in idempotent.wo's pool_begin catch

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
(cherry picked from commit c53ad583051abeeeb302301fc3d91073f0a15fcc)
This commit is contained in:
shoney.arickathil 2026-08-30 03:17:39 +02:00
parent 359d21a57f
commit 03a7ad6658

View file

@ -34,7 +34,10 @@ pub class Limiter {
fn before(mut req: Req) -> ?Resp {
let key = limiter_key(self, req);
let v = try pool_count(self.pool, key, self.limit, self.window) catch (e) nil;
let v = try pool_count(self.pool, key, self.limit, self.window) catch (e) {
print_err("limiter: pool_count trapped: ${e.msg}");
nil
};
if v == nil {
let r = Resp { status: 503, headers: {}, body: "{\"error\":\"rate limiter saturated\"}" };