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

Disallow concurrent retrieval deals for same peer/cid #493

Merged
merged 1 commit into from
Feb 24, 2021

Conversation

dirkmc
Copy link
Contributor

@dirkmc dirkmc commented Feb 19, 2021

@dirkmc dirkmc requested a review from nonsense February 19, 2021 16:01
@codecov-io
Copy link

codecov-io commented Feb 19, 2021

Codecov Report

Merging #493 (ea7b41d) into master (55c09b0) will increase coverage by 0.25%.
The diff coverage is 86.03%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #493      +/-   ##
==========================================
+ Coverage   65.16%   65.41%   +0.25%     
==========================================
  Files          50       51       +1     
  Lines        3266     3431     +165     
==========================================
+ Hits         2128     2244     +116     
- Misses        912      958      +46     
- Partials      226      229       +3     
Impacted Files Coverage Δ
...etrievalmarket/impl/providerstates/provider_fsm.go 6.46% <0.00%> (ø)
retrievalmarket/types.go 41.47% <ø> (ø)
...rievalmarket/impl/requestvalidation/revalidator.go 76.23% <22.23%> (-3.33%) ⬇️
retrievalmarket/impl/clientstates/client_fsm.go 72.42% <25.00%> (-1.92%) ⬇️
retrievalmarket/impl/client.go 70.43% <90.91%> (+2.03%) ⬆️
retrievalmarket/impl/clientstates/client_states.go 92.41% <100.00%> (+0.10%) ⬆️
...ievalmarket/impl/providerstates/provider_states.go 90.70% <100.00%> (+0.46%) ⬆️
retrievalmarket/migrations/migrations.go 71.43% <100.00%> (ø)

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 d1405ef...ea7b41d. Read the comment docs.

@dirkmc dirkmc force-pushed the fix/dup-retr-deal branch 3 times, most recently from c4c8c15 to f9e8df5 Compare February 19, 2021 16:07
Copy link
Member

@nonsense nonsense left a comment

Choose a reason for hiding this comment

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

lgtm

@dirkmc dirkmc merged commit d5b1990 into master Feb 24, 2021
@dirkmc dirkmc deleted the fix/dup-retr-deal branch February 24, 2021 13:07
@@ -281,6 +296,31 @@ func (c *Client) Retrieve(ctx context.Context, payloadCID cid.Cid, params retrie
return dealID, nil
}

// Check if there's already an active retrieval deal with the same peer
// for the same payload CID
func (c *Client) checkForActiveDeal(payloadCID cid.Cid, pid peer.ID) error {
Copy link
Member

Choose a reason for hiding this comment

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

nit: It would be more idiomatic to return (dealID, bool) here, and create the error in the caller.

@dirkmc dirkmc mentioned this pull request Mar 22, 2021
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.

4 participants