Repository navigation
Catch OSError when persisting heartbeat to queue (carry of #113) - #124
Conversation
Prevents a crash when the disk is full by catching OSError in add_request() and logging a warning instead of letting it propagate. Fixes ActivityWatch#8 Git-Session-Id: 331e
Git-Session-Id: 331e
|
Address Greptile P2: the test only checked that add_request did not raise, so it would still pass if the warning were dropped. Capture the log and assert the message. Contributor commit is unchanged. Git-Session-Id: a465ce34-c352-5c57-b74b-421395a454ca
|
Thanks for the review. I pushed On the other two findings:
CI was green on the earlier head; |
add_request now returns False when the request could not be persisted, and heartbeat() keeps the uncommitted interval in last_heartbeat so the next heartbeat retries it instead of dropping it. A sustained failure warns once per failure streak instead of once per heartbeat. Git-Session-Id: 5e84
|
@greptileai review |
persistqueue's SQLite backend reports a full disk as
sqlite3.OperationalError ('database or disk is full'), which is not an
OSError subclass, so the original catch never fired on the real failure.
Test fills a capped SQLite queue for real and checks recovery.
Git-Session-Id: 5e84
|
Two more changes on this carry:
All new tests fail without the fix. black and mypy clean. |
…te fails When the pending heartbeat could not be queued and the new one could not merge with it, the new heartbeat was discarded. Hold the failed commit in a per-bucket buffer and retry it, in order, before the next commit. Git-Session-Id: f1742c6c-397a-5e37-91c6-b593b9447fde
|
@greptileai review |
During a sustained queue-write failure each non-mergeable heartbeat was appended to an unbounded list. Cap it per bucket (deque, oldest dropped). Git-Session-Id: b54176d0-ff0b-576d-82d1-217e70bc2813
|
@greptileai review |
Warn once when a bucket's unqueued-heartbeat buffer first evicts, and log the total dropped once queue writes recover. Git-Session-Id: b63df882-1f20-5b54-b192-9df60d59a03e
Git-Session-Id: b63df882-1f20-5b54-b192-9df60d59a03e
|
Review findings are addressed through Current head has six passing checks; macOS tests are still queued. No further review round or code change needed. Waiting for the remaining CI check and maintainer review/merge (I have pull-only access here). |
…vityWatch#125/ActivityWatch#130 - tests: pass tmp_path to _fresh_queue (ActivityWatch#130 made queues isolated per test) - RequestQueue.__init__: keep _queue_write_failing (ActivityWatch#124) after the batch state - wait_for_queue_empty (ActivityWatch#125): track the in-flight batch instead of _current - drop an import left unused by the rebase Git-Session-Id: 68f2e145-fcff-459d-8e16-c3e43269f5fa
…ityWatch#125/ActivityWatch#130 - send an empty heartbeat payload instead of dropping it: the post guard should only skip an insert reconciled down to nothing (caught by ActivityWatch#125's test_wait_for_queue_empty_timeout) - tests: pass tmp_path to _fresh_queue (ActivityWatch#130 made queues isolated per test) - tests: silence mypy method-assign on the refuse-then-restore stubs (CI runs make typecheck) Git-Session-Id: 68f2e145-fcff-459d-8e16-c3e43269f5fa
Rebased carry of #113 by @rtsdque onto current master (conflicted with the
register_bucketrework). Original commit and authorship preserved; no code changes beyond conflict resolution.tests/test_requestqueue.py: 5 passed.Thanks @rtsdque. I can't push to your fork, so this is a carry PR; feel free to rebase #113 from
carry-113instead.Review note (non-blocking):
add_requestlogs a warning on every dropped heartbeat, so a full disk will log once per heartbeat. Rate-limiting it (log first failure, then every N) would avoid a flood.