Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

Commit

Permalink
code review updates
Browse files Browse the repository at this point in the history
Signed-off-by: Merlin Ran <merlinran@gmail.com>
  • Loading branch information
merlinran committed Jul 26, 2021
1 parent f2d7853 commit 9e8f415
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,10 @@ Also take the file system overhead into consideration when calculating the limit
No limit by default.`,
},
{
Name: "sealing-sectors-limit",
DefValue: 0,
Description: "If set, stop bidding if the number of Lotus sealing sectors exceeds this limit.",
Name: "sealing-sectors-limit",
DefValue: 0,
Description: `If bigger than zero, stop bidding if the number of Lotus sealing sectors exceeds this limit.
Zero means no limits`,
},
{
Name: "deal-data-fetch-attempts",
Expand Down
4 changes: 3 additions & 1 deletion service/lotusclient/lotusclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ func (c *Client) CurrentSealingSectors() (int, error) {

ctx, cancel := context.WithTimeout(c.ctx, requestTimeout)
defer cancel()
start := time.Now()
sectorsByState, err := c.c.SectorsSummary(ctx)
log.Debugf("SectorsSummary() call took %.2f seconds", time.Since(start).Seconds())
if err != nil {
return 0, err
return 0, fmt.Errorf("getting lotus sectors summary: %s", err)
}
total := 0
for _, i := range sectorsByState {
Expand Down
2 changes: 1 addition & 1 deletion service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ func (s *Service) makeBid(a *pb.Auction, from core.ID) error {
if err != nil {
return fmt.Errorf("getting number of sealing sectors: %v", err)
}
if n >= s.sealingSectorsLimit {
if n > s.sealingSectorsLimit {
log.Infof("not bidding: lotus already have %d sealing sectors", n)
return nil
}
Expand Down

0 comments on commit 9e8f415

Please sign in to comment.