Skip to content

Commit

Permalink
fix(storagemarket): run deal restarts in go routine (#309)
Browse files Browse the repository at this point in the history
Deal restarts make take a while particularly if there are connection timeouts. There's no reason to
run them synchronously in node initialization
  • Loading branch information
hannahhoward authored Jul 2, 2020
1 parent 4fcaee3 commit 57ff8d6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 7 additions & 1 deletion storagemarket/impl/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ func NewClient(
// Start initializes deal processing on a StorageClient and restarts
// in progress deals
func (c *Client) Start(ctx context.Context) error {
return c.restartDeals()
go func() {
err := c.restartDeals()
if err != nil {
log.Errorf("Failed to restart deals: %s", err.Error())
}
}()
return nil
}

// Stop ends deal processing on a StorageClient
Expand Down
12 changes: 6 additions & 6 deletions storagemarket/impl/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,12 @@ func (p *Provider) Start(ctx context.Context) error {
if err != nil {
return err
}

err = p.restartDeals()
if err != nil {
return err
}

go func() {
err := p.restartDeals()
if err != nil {
log.Errorf("Failed to restart deals: %s", err.Error())
}
}()
return nil
}

Expand Down

0 comments on commit 57ff8d6

Please sign in to comment.