Skip to content

fix(cli): add configurable context.WithTimeout to all CLI handler functions#76

Merged
pcfreak30 merged 1 commit into
developfrom
feat/context-timeout
Jun 11, 2026
Merged

fix(cli): add configurable context.WithTimeout to all CLI handler functions#76
pcfreak30 merged 1 commit into
developfrom
feat/context-timeout

Conversation

@pcfreak30

@pcfreak30 pcfreak30 commented Jun 11, 2026

Copy link
Copy Markdown
Member
  • Add DefaultTimeout (30s), UploadTimeout (300s), SyncTimeout (60s) to config
  • Add accessor methods with fallback defaults: GetDefaultTimeout(), GetUploadTimeout(), GetSyncTimeout()
  • Add context.WithTimeout to ~52 handler functions across 20 files
  • Watch loops use original ctx (no timeout) via setupCtx pattern
  • Sync/profiling handlers use GetSyncTimeout(), upload/bench use GetUploadTimeout()
  • Update test mocks with cfgMgr.EXPECT().Config().Return().Maybe()
  • admin_quota.go and ipns.go unchanged (already had hardcoded timeouts)

Add configurable context timeouts to all CLI handler functions. Three new timeout settings are introduced in the config (default_timeout, upload_timeout, sync_timeout) with sensible defaults (30s, 5m, 1m respectively), and each CLI action now applies the appropriate context.WithTimeout before making API calls. Upload/download/benchmark operations use the upload timeout, sync/cleanup/reconciliation operations use the sync timeout, and all other operations use the default timeout. Tests were updated to use mock.Anything for context arguments and to mock the new Config() calls needed for timeout resolution.

…ctions

- Add DefaultTimeout (30s), UploadTimeout (300s), SyncTimeout (60s) to config
- Add accessor methods with fallback defaults: GetDefaultTimeout(), GetUploadTimeout(), GetSyncTimeout()
- Add context.WithTimeout to ~52 handler functions across 20 files
- Watch loops use original ctx (no timeout) via setupCtx pattern
- Sync/profiling handlers use GetSyncTimeout(), upload/bench use GetUploadTimeout()
- Update test mocks with cfgMgr.EXPECT().Config().Return().Maybe()
- admin_quota.go and ipns.go unchanged (already had hardcoded timeouts)
@kody-ai

kody-ai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug
Performance
Security
Business Logic

Access your configuration settings here.

@github-actions

Copy link
Copy Markdown

Code Coverage Report

Total Coverage: 53.5%

Generated from commit: 9221dce
Repository: LumeWeb/pinner-cli

@pcfreak30 pcfreak30 merged commit fb53afd into develop Jun 11, 2026
2 checks passed
@pcfreak30 pcfreak30 deleted the feat/context-timeout branch June 11, 2026 18:58
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.

1 participant