Merge pull request #5032 from filecoin-project/fix/cancel-transfer

Cancel transfer cancels storage deal
This commit is contained in:
Łukasz Magiera
2020-12-01 14:57:58 +01:00
committed by GitHub
5 changed files with 24 additions and 9 deletions
+8 -1
View File
@@ -1854,6 +1854,11 @@ var clientCancelTransfer = &cli.Command{
Usage: "specify only transfers where peer is/is not initiator",
Value: true,
},
&cli.DurationFlag{
Name: "cancel-timeout",
Usage: "time to wait for cancel to be sent to storage provider",
Value: 5 * time.Second,
},
},
Action: func(cctx *cli.Context) error {
if !cctx.Args().Present() {
@@ -1897,7 +1902,9 @@ var clientCancelTransfer = &cli.Command{
}
}
return api.ClientCancelDataTransfer(ctx, transferID, other, initiator)
timeoutCtx, cancel := context.WithTimeout(ctx, cctx.Duration("cancel-timeout"))
defer cancel()
return api.ClientCancelDataTransfer(timeoutCtx, transferID, other, initiator)
},
}
+1 -1
View File
@@ -82,7 +82,7 @@ func RunClientTest(t *testing.T, cmds []*lcli.Command, clientNode test.TestNode)
fmt.Println("list-deals:\n", out)
lines := strings.Split(out, "\n")
require.Len(t, lines, 2)
require.GreaterOrEqual(t, len(lines), 2)
re := regexp.MustCompile(`\s+`)
parts := re.Split(lines[1], -1)
if len(parts) < 4 {