Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add context in Put api call for cp/mirror #2291

Merged
merged 1 commit into from
Oct 20, 2017
Merged

Conversation

poornas
Copy link
Contributor

@poornas poornas commented Oct 16, 2017

Addresses issue #2255. This PR passes context in mc Put api calls so that request cancellation with context

@codecov-io
Copy link

codecov-io commented Oct 16, 2017

Codecov Report

Merging #2291 into master will decrease coverage by <.01%.
The diff coverage is 9.67%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2291      +/-   ##
==========================================
- Coverage   10.65%   10.64%   -0.01%     
==========================================
  Files         100      100              
  Lines        9632     9640       +8     
==========================================
  Hits         1026     1026              
- Misses       8471     8479       +8     
  Partials      135      135
Impacted Files Coverage Δ
cmd/common-methods.go 0% <0%> (ø) ⬆️
cmd/cp-main.go 0% <0%> (ø) ⬆️
cmd/mirror-main.go 0% <0%> (ø) ⬆️
cmd/client-s3.go 15.17% <100%> (ø) ⬆️
cmd/client-fs.go 30.23% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 59685e2...5d31e9a. Read the comment docs.

@@ -105,7 +106,9 @@ func putTargetStream(alias string, urlStr string, reader io.Reader, size int64,
if err != nil {
return 0, err.Trace(alias, urlStr)
}
n, err := targetClnt.Put(reader, size, metadata, progress)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can combine this cancel with trapCh so that if we do get a signal like CTRL-C <-trapCh we cleanly exit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@deekoder deekoder merged commit a86080a into minio:master Oct 20, 2017
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.

5 participants