Merge pull request #5921 from filecoin-project/fix/retrieve-success-handling
Fix success handling in Retreival
This commit is contained in:
commit
91c87b7069
@ -1185,6 +1185,8 @@ var clientRetrieveCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("error setting up retrieval: %w", err)
|
return xerrors.Errorf("error setting up retrieval: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var prevStatus retrievalmarket.DealStatus
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case evt, ok := <-updates:
|
case evt, ok := <-updates:
|
||||||
@ -1195,14 +1197,23 @@ var clientRetrieveCmd = &cli.Command{
|
|||||||
retrievalmarket.ClientEvents[evt.Event],
|
retrievalmarket.ClientEvents[evt.Event],
|
||||||
retrievalmarket.DealStatuses[evt.Status],
|
retrievalmarket.DealStatuses[evt.Status],
|
||||||
)
|
)
|
||||||
} else {
|
prevStatus = evt.Status
|
||||||
afmt.Println("Success")
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if evt.Err != "" {
|
if evt.Err != "" {
|
||||||
return xerrors.Errorf("retrieval failed: %s", evt.Err)
|
return xerrors.Errorf("retrieval failed: %s", evt.Err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !ok {
|
||||||
|
if prevStatus == retrievalmarket.DealStatusCompleted {
|
||||||
|
afmt.Println("Success")
|
||||||
|
} else {
|
||||||
|
afmt.Printf("saw final deal state %s instead of expected success state DealStatusCompleted\n",
|
||||||
|
retrievalmarket.DealStatuses[prevStatus])
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return xerrors.Errorf("retrieval timed out")
|
return xerrors.Errorf("retrieval timed out")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user