The reader took its lease for the budget plus 60 seconds, but the budget
only stops new reads from starting. A read started near the deadline may
run for the whole read timeout, so a run could outlive its lease and
have every result discarded, possibly on every cycle.
Reader::run() now takes the read timeout and holds the lease for
budget + read timeout + 60, in line with the process registration in
poller_pfs.php. A lifecycle scenario runs a read from the budget's end
to a 120 second timeout and checks that its results are written.
Fixes #79
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Fixes #79.
The budget only stops new reads from starting, so a read started near the deadline can run for the whole read timeout. The lease covered only budget + 60, so such a run could lose its lease and discard every result.
Change:
Reader::run()takes the read timeout and leases for budget + read timeout + 60, matching the process registration inpoller_pfs.php. Test callers passSettings::DEFAULT_TIMEOUT. New lifecycle scenarioreader_overrun: a read runs from the budget's end to a 120 s timeout, and its results and run counts are written.Verification (local, PHP 8.3 + Cacti 1.2.31 + MariaDB 11.8): Pest unit 273 passed, lifecycle 26 passed (the new test fails with the old lease length), PHPStan no errors, page and device permission scripts all PASS, PHP 8.0 lint clean.
Risk: low. A reader that has actually died holds its poller's lease longer, by the read timeout (30 s by default).
Summary by CodeRabbit