Skip to content

Commit

Permalink
fix(storagemarket): run deal restarts in go routine
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 committed Jul 2, 2020
1 parent f644baa commit a5c9555
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 @@ -91,7 +91,13 @@ func NewClient(
}

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
}

func (c *Client) Stop() error {
Expand Down
12 changes: 6 additions & 6 deletions storagemarket/impl/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,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 a5c9555

Please sign in to comment.