Skip to content

Propagate context through all API calls and add --timeout flag#326

Merged
AndreyVMarkelov merged 1 commit into
dropbox:masterfrom
AndreyVMarkelov:feat/context-timeout
Jul 4, 2026
Merged

Propagate context through all API calls and add --timeout flag#326
AndreyVMarkelov merged 1 commit into
dropbox:masterfrom
AndreyVMarkelov:feat/context-timeout

Conversation

@AndreyVMarkelov

@AndreyVMarkelov AndreyVMarkelov commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Thread context.Context through every Dropbox SDK call so operations respect cancellation and deadlines
  • Add a global --timeout flag that sets a context deadline for all network operations (e.g. --timeout 30s, --timeout 2m)
  • Make retry backoff sleep context-aware — cancellation stops retries immediately without wasting attempts
  • Narrow client interfaces to only the *Context methods used, improving testability
  • Harden CI workflows with explicit read-only permissions

Test plan

  • gofmt — no issues
  • go vet — clean
  • go test ./... — all pass
  • Manual: ls /, account, du, search, put, get, rm, revs — all work
  • Manual: --timeout 30s ls / — succeeds normally
  • Manual: --timeout 1ms ls / — fails with context deadline exceeded
  • Manual: --timeout -1s ls / — rejected with validation error

Thread context.Context through every Dropbox SDK call so that operations
respect cancellation and deadlines. Add a global --timeout flag that sets
a context deadline for all network operations (e.g. --timeout 30s).

The retry loop now respects context cancellation during backoff sleep,
and context errors are never retried. Client interfaces are narrowed to
only the *Context methods actually used, improving testability.

Also hardens CI workflows with explicit read-only permissions.
@AndreyVMarkelov AndreyVMarkelov merged commit f5ac66e into dropbox:master Jul 4, 2026
9 checks passed
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