Watch context for completion also

This commit is contained in:
Ingar Shu 2020-08-11 13:48:56 -07:00
parent 53e06f358a
commit 02b0c8dd94
No known key found for this signature in database
GPG Key ID: BE3D9CE79F22E769
2 changed files with 6 additions and 10 deletions

View File

@ -399,15 +399,9 @@ func testRetrieval(t *testing.T, ctx context.Context, err error, client *impl.Fu
IsCAR: carExport, IsCAR: carExport,
} }
updates, err := client.ClientRetrieve(ctx, offers[0].Order(caddr), ref) updates, err := client.ClientRetrieve(ctx, offers[0].Order(caddr), ref)
for { for update := range updates {
select { if update.Err != nil {
case update, ok := <-updates: t.Fatalf("%+v", err)
if !ok {
break
}
if update.Err != nil {
t.Fatalf("%+v", err)
}
} }
} }

View File

@ -860,8 +860,10 @@ var clientRetrieveCmd = &cli.Command{
} }
if evt.Err != nil { if evt.Err != nil {
return xerrors.Errorf("Retrieval Failed: %w", err) return xerrors.Errorf("retrieval failed: %w", err)
} }
case <-ctx.Done():
return xerrors.Errorf("retrieval timed out")
} }
} }
}, },