Skip to content

fix(transport): bump default request-timeout from 2s to 10s#15

Merged
ale-rinaldi merged 1 commit into
mainfrom
fix/issue-7-request-timeout-default
May 15, 2026
Merged

fix(transport): bump default request-timeout from 2s to 10s#15
ale-rinaldi merged 1 commit into
mainfrom
fix/issue-7-request-timeout-default

Conversation

@ale-rinaldi

Copy link
Copy Markdown
Contributor

Closes #7.

What changed

--request-timeout default goes from 2s to 10s. Same change in three places (TCP transport, RTU transport, CLI flag) plus the README table. Help-string wording unchanged — terse style matches surrounding flags.

Why 10s and not 30s

The issue mentions 30s "makes the problem go away" but that's a confirmed-OK value, not a measured minimum. 10s sits comfortably above the 2s failure point while preserving a useful fast-fail signal for genuinely stuck connections — falling back from "why is this hanging" diagnostics from 2s to 30s would be a regression for the routine operator. Users running unusually large imports can still raise via --request-timeout or MYTHY_REQUEST_TIMEOUT.

Why a global bump and not a per-operation override

The cleaner shape would be: keep --request-timeout short and add a separate --commit-timeout consulted only inside Edit.Commit. I looked at this; the underlying simonvetter/modbus client has no public setter for its request timeout after construction (SetTimeout/SetRequestTimeout etc. don't exist on the Client interface, and the field is initialised at Open time). The two alternatives — re-opening the client around the commit, or vendoring/forking the library — both cost more than the bug justifies. Banking the global bump and keeping per-operation overrides as a follow-up if 10s ever stops being enough.

Tests

No new tests. The change is a constant in three locations; behaviour-level coverage would have to assert on the modbus library's internal timer, which isn't observable from outside.

🤖 Generated with Claude Code

The default 2s was tight enough that END_CHANGE_DB (the flash-commit
trigger fired at the end of a write transaction) routinely timed out
on non-trivial imports, even though the device actually finished the
commit successfully. The user-visible result was a non-zero exit code
plus a confusing "timed out" message immediately after the operation
the user wanted had in fact landed.

Calibration: the reporter confirmed 30s as a value that's clearly
sufficient and 2s as one that isn't; 10s is the middle ground that
preserves a useful fast-fail signal for actually-stuck connections
while covering typical commits with comfortable margin. Users
performing very large transactions still have --request-timeout (or
MYTHY_REQUEST_TIMEOUT) to raise further.

This is a global bump rather than a per-operation override because
the underlying simonvetter/modbus client doesn't expose a setter for
the request timeout post-construction, and recreating the client
just to widen one round-trip would be heavier than the problem
warrants.

Closes #7

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ale-rinaldi ale-rinaldi merged commit c15cef3 into main May 15, 2026
2 checks passed
@ale-rinaldi ale-rinaldi deleted the fix/issue-7-request-timeout-default branch May 15, 2026 09:25
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.

Default --request-timeout 2s times out on END_CHANGE_DB for large edit transactions

1 participant