s3sync icon indicating copy to clipboard operation
s3sync copied to clipboard

Allow users to provide their own context

Open tydomitrovich opened this issue 3 years ago • 3 comments

Objective

Most of the methods in the AWS SDK for Go have a "WithContext" variant that allows callers to pass in a context. I have found this feature useful for cancelling long-running calls when the parent context is canceled. It would be nice to have a SyncWithContext() method with equivalent functionality.

Deliverables

  • [ ] A method that allows the caller to provide a context to the underlying sync code exists

Approach (optional)

It looks like the bulk of the code already accepts a context and the Sync method passes context.Background() to this code. We could add SyncWithContext() method that is identical to Sync() except that it uses a context parameter instead of Background(). Then Sync() could just call SyncWithContext() with context.Background() as a parameter.

tydomitrovich avatar Dec 02 '22 19:12 tydomitrovich

I would like to contribute to this issue. Can I?

RA-Balaji avatar Oct 23 '23 11:10 RA-Balaji

@RA-Balaji sure, PR is welcomed!

at-wat avatar Oct 30 '23 03:10 at-wat

Kindly review the PR: https://github.com/seqsense/s3sync/pull/381

RA-Balaji avatar Nov 17 '23 13:11 RA-Balaji