← Back to PRs

#18221: fix(cli): raise cron command timeout to 90s and retry read-only RPCs

by BinHPdev open 2026-02-16 16:30 View on GitHub →
channel: mattermost cli size: M
## Summary - Add optional `{ defaultTimeoutMs }` parameter to `addGatewayClientOptions` so per-command defaults can override the global 30s timeout without affecting other CLI surfaces. - Apply 90s default to all cron CLI registrations (status, list, add, edit, rm, enable, disable, runs, run). - Retry once (after 250ms) for idempotent read-only cron methods (`cron.status`, `cron.list`, `cron.runs`) when the error is a gateway timeout. Closes #18118 ## Test plan - [x] New `gateway-rpc.test.ts` with 6 tests: retry on timeout for each read-only method, no retry for non-cron/mutating/non-timeout errors - [x] New test in `cron-cli.test.ts` verifying 90s default timeout is passed through - [x] All 22 existing + new cron CLI tests pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- greptile_comment --> <h3>Greptile Summary</h3> Adds a per-command `defaultTimeoutMs` option to `addGatewayClientOptions` and applies a 90s timeout default to all cron CLI commands (status, list, add, edit, rm, enable, disable, runs, run). Also implements retry logic for read-only cron methods (`cron.status`, `cron.list`, `cron.runs`) that automatically retries once after 250ms when a gateway timeout occurs. The implementation correctly scopes retries to only idempotent read operations and excludes mutating commands like `cron.add` or `cron.remove`. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk - The changes are well-tested with comprehensive unit tests covering all retry scenarios (positive and negative cases). The implementation is clean and scoped - only affecting cron CLI commands with increased timeout and retry only on idempotent read operations. Test coverage includes verification that non-retryable methods don't retry, and that only timeout errors trigger retries. - No files require special attention <sub>Last reviewed commit: ee2abb7</sub> <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs