Skip to content

Fix fractional server-session housekeeping intervals - #189

Open
dajiaohuang wants to merge 1 commit into
agrafix:masterfrom
dajiaohuang:fix/housekeeping-interval-delay
Open

dajiaohuang wants to merge 1 commit into
agrafix:masterfrom
dajiaohuang:fix/housekeeping-interval-delay

Conversation

@dajiaohuang

Copy link
Copy Markdown

Problem

Server-session housekeeping intervals are NominalDiffTime values in seconds, but the housekeeping loop rounded the interval to a whole second before converting it to microseconds. A valid fractional interval such as 0.1 seconds therefore became threadDelay 0, so the forever-loop repeatedly swept sessions without yielding; a 1.5-second interval was also changed to 2 seconds.

Fix

  • Convert seconds directly to microseconds, rounding up and clamping to a positive Int delay.
  • Reject non-positive housekeeping intervals for enabled server-session backends before starting the background thread.
  • Add regression coverage for fractional conversions and zero-interval rejection.

Validation

  • git diff --check passed.
  • Added Hspec tests, but could not run them locally: GHC and Cabal are absent in the isolated task environment. The recorded Stack bootstrap sHGetFolderPath fault budget was exhausted previously, so Stack was not retried. No PostgreSQL service or other test service was started locally.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant