Add bounds check for heartbeat interval #1068
Merged
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.
What was changed
Only allow worker heartbeating interval to be between 1s and 60s
Also changed heartbeat test to account for if
host_cpu_usageis so low it rounds down to 0.0.Why?
Checklist
Closes
How was this tested:
Note
Adds builder validation to enforce
heartbeat_intervalbetween 1s and 60s and updates integration tests to use 1s heartbeats with adjusted timings/assertions.RuntimeOptionsnow uses builder validation to enforceheartbeat_intervalin[1s, 60s]and derivesDefault(default remainsSome(60s)) incrates/sdk-core/src/lib.rs.crates/sdk-core/tests/integ_tests/worker_heartbeat_tests.rsto useheartbeat_interval(Some(Duration::from_secs(1)))instead of 100ms.150ms→1500ms,200ms→2000ms,sleep 200ms→2s) and bump some activitystart_to_close_timeoutvalues (1s→5s).>= 0.Written by Cursor Bugbot for commit bef7d41. This will update automatically on new commits. Configure here.