Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v2 #2204 +/- ##
=====================================
Coverage ? 94.03%
=====================================
Files ? 184
Lines ? 13568
Branches ? 0
=====================================
Hits ? 12759
Misses ? 809
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
|
Waiting for V2 as this might be breaking change and will inlcude removal of deprecated fields |
Pijukatel
force-pushed
the
claude/actor-resurrection-time-tracking-bixxkl
branch
from
October 20, 2026 07:47
4b9f3e5 to
8af9ee3
Compare
Pijukatel
force-pushed
the
claude/actor-resurrection-time-tracking-bixxkl
branch
2 times, most recently
from
October 20, 2026 09:43
d6cf367 to
278c17b
Compare
…r resurrection The `crawler_runtime` statistic no longer counts the downtime between the runs of a resumed crawler, and it accumulates correctly across any number of persist/resume cycles: - The first periodic statistics log reports exactly the runtime accumulated so far: zero for a fresh start, the previously persisted total for a resumed run. - The accumulated runtime is stored in the new `accumulated_runtime` field, persisted under `crawlerRuntimeMillis`. Every persist writes the live total, so a state persisted mid-run (migration, abort) carries the runtime up to that moment and a resumed run continues from the last checkpoint. - The timestamps of the previous run are cleared before the new run starts being measured, so they cannot leak the downtime into the runtime, and a backwards clock jump during a run cannot push the runtime below the accumulated total. BREAKING CHANGE: `StatisticsState.crawler_runtime_for_serialization` is removed; the `crawler_runtime` property is backed by the new `accumulated_runtime` field. `crawlerRuntimeMillis` is serialized as a number of milliseconds instead of an ISO 8601 duration string. The unused state fields `errors`, `retry_errors`, `requests_finished_per_minute` and `requests_failed_per_minute` are removed from `StatisticsState`. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VMHwDx87jV4rnu5LkbpNxy
Pijukatel
force-pushed
the
claude/actor-resurrection-time-tracking-bixxkl
branch
from
October 20, 2026 11:26
278c17b to
d4efa71
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
After an Actor migration, resurrection or abort,
crawler_runtimemisbehaved: the first periodic log of the resumed run included the whole downtime (e.g.38.01sright after resurrection of a run whose real runtime was ~0.5 s), the downtime could get permanently baked into the statistics, and with repeated resurrections only the last run's segment survived.This is a v2-targeted rework that makes the runtime a plain accumulated statistic:
StatisticsState.accumulated_runtime(persisted ascrawlerRuntimeMillis) holds the runtime accumulated by the previous runs; the read-onlycrawler_runtimeproperty adds the elapsed time of the run in progress, measured by thecrawler_last_started_at/crawler_finished_attimestamps.accumulated_runtimewrites the live total, so every persist is an exact checkpoint: a state persisted mid-run (periodic persist, migration event) carries the runtime up to that moment. After an unclean termination, the resumed run continues from the last checkpoint, so no downtime is ever counted and at most the tail since the last persist is lost.Statistics.__aenter__clears the previous run's timestamps before the periodic logger starts, so the restored total is reported as-is and the downtime between runs can never leak into the runtime. The documented invariant: timestamps of a loaded state are history, not measurement anchors.accumulated_runtimefield:Statisticscommunicates with the state only through the existing public timestamp fields.Guarantees (all covered by tests in
tests/unit/_statistics/test_persistence.py):Breaking changes (v2)
StatisticsState.crawler_runtime_for_serializationis removed;crawler_runtimeis a read-only property (the setter was already removed by refactor!: remove deprecatedStatisticsState.crawler_runtimesetter #2315) backed by the newaccumulated_runtimefield.crawlerRuntimeMillisis serialized as a number of milliseconds, consistent with the other*Millisfields and with Crawlee for JavaScript, instead of an ISO 8601 duration string. (A v1 state with an ISO duration string still loads, since thetimedelta_msvalidator falls back to ISO parsing, but v1 compatibility is not a goal of this PR.)StatisticsStatefieldserrors,retry_errors,requests_finished_per_minuteandrequests_failed_per_minuteare removed. They were never populated; theFinalStatisticsfields of the same names are unaffected.The upgrading guide (
docs/upgrading/upgrading_to_v2.md) documents all of the above.Related
StatisticsState.crawler_runtimesetter #1567 (the deprecatedcrawler_runtimesetter itself was removed in refactor!: remove deprecatedStatisticsState.crawler_runtimesetter #2315).🤖 Generated with Claude Code
https://claude.ai/code/session_01VMHwDx87jV4rnu5LkbpNxy