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

Timeout provider after waiting a period of time for transfer to restart #655

Merged
merged 3 commits into from Dec 17, 2021

Conversation

hannahhoward
Copy link
Collaborator

Goals

Currently, when a provider restarts when a data transfer is in progress, it goes into a waiting state for the client to restart the transfer. If the client doesn't restart the transfer, the provider simply stays in this state forever, never failing the deal. This can happen for example if the provider was offline long enough for the client to attempt restarts until it gave up and failed the deal on its own side.

Implementation

After a configurable amount of time (default 1 hour) in the awaiting restart state, if the transfer is not restart, fail the deal. This is accomplished via a state handler that fires a timeout event always after a the given time. If the state has transitioned by then, the event has no effect. If it has not transitioned to something else, and the provider is still waiting, the deal fails.

@codecov-commenter
Copy link

codecov-commenter commented Dec 17, 2021

Codecov Report

Merging #655 (67a29d2) into master (e111ec2) will increase coverage by 0.36%.
The diff coverage is 87.10%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #655      +/-   ##
==========================================
+ Coverage   59.37%   59.72%   +0.36%     
==========================================
  Files          63       63              
  Lines        5234     5253      +19     
==========================================
+ Hits         3107     3137      +30     
+ Misses       1793     1782      -11     
  Partials      334      334              
Impacted Files Coverage Δ
storagemarket/events.go 0.00% <ø> (ø)
storagemarket/impl/provider.go 25.74% <81.25%> (-<0.01%) ⬇️
...oragemarket/impl/providerstates/provider_states.go 85.58% <87.50%> (+0.06%) ⬆️
storagemarket/impl/provider_environments.go 10.91% <100.00%> (+2.50%) ⬆️
storagemarket/impl/providerstates/provider_fsm.go 74.60% <100.00%> (+0.87%) ⬆️
shared/ready.go 79.17% <0.00%> (+14.59%) ⬆️
retrievalmarket/events.go 80.00% <0.00%> (+80.00%) ⬆️
retrievalmarket/dealstatus.go 80.00% <0.00%> (+80.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 e111ec2...67a29d2. Read the comment docs.

Copy link
Contributor

@dirkmc dirkmc left a comment

Choose a reason for hiding this comment

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

One nit but otherwise LGTM 👍

@@ -208,6 +210,23 @@ func DecideOnProposal(ctx fsm.Context, environment ProviderDealEnvironment, deal
return ctx.Trigger(storagemarket.ProviderEventDataRequested)
}

const restartTimeout = 1 * time.Hour
Copy link
Contributor

Choose a reason for hiding this comment

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

Is restartTimeout used anywhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nope accidental leftover -- became defaultRestartTimeout -- will delete

@hannahhoward hannahhoward merged commit a7ddd51 into master Dec 17, 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.

None yet

3 participants