Skip to content

Commit f99c6e4

Browse files
committed
Address code review
Signed-off-by: Jakub Sztandera <[email protected]>
1 parent 26e55a3 commit f99c6e4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

builtin/v16/power/power_state.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func (st *State) CollectEligibleClaims(s adt.Store, cacheInOut *builtin.MapReduc
165165
return nil, xerrors.Errorf("failed to load claims: %w", err)
166166
}
167167
var out Claim
168-
claims.ForEach(&out, func(k string) error {
168+
err = claims.ForEach(&out, func(k string) error {
169169
if !out.RawBytePower.GreaterThan(abi.NewStoragePower(0)) {
170170
return nil
171171
}
@@ -180,7 +180,7 @@ func (st *State) CollectEligibleClaims(s adt.Store, cacheInOut *builtin.MapReduc
180180
})
181181
return nil
182182
})
183-
return res, nil
183+
return res, err
184184
}
185185
cache, ok := (*cacheInOut).(powerMapReduceCache)
186186
if !ok {
@@ -211,6 +211,7 @@ func (st *State) CollectEligibleClaims(s adt.Store, cacheInOut *builtin.MapReduc
211211
}
212212
return out, nil
213213
}
214+
// cache size of 2000 is arbitrary, but seems to work well mith 600k claims with room for it to grow
214215
cmr, err := hamt.NewCachedMapReduce[Claim, *Claim, []builtin.OwnedClaim](mapper, reducer, 2000)
215216
if err != nil {
216217
return nil, err

builtin/v17/power/power_state.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ func (st *State) CollectEligibleClaims(s adt.Store, cacheInOut *builtin.MapReduc
165165
return nil, xerrors.Errorf("failed to load claims: %w", err)
166166
}
167167
var out Claim
168-
claims.ForEach(&out, func(k string) error {
168+
err = claims.ForEach(&out, func(k string) error {
169169
if !out.RawBytePower.GreaterThan(abi.NewStoragePower(0)) {
170170
return nil
171171
}
@@ -180,7 +180,7 @@ func (st *State) CollectEligibleClaims(s adt.Store, cacheInOut *builtin.MapReduc
180180
})
181181
return nil
182182
})
183-
return res, nil
183+
return res, err
184184
}
185185
cache, ok := (*cacheInOut).(powerMapReduceCache)
186186
if !ok {
@@ -211,6 +211,7 @@ func (st *State) CollectEligibleClaims(s adt.Store, cacheInOut *builtin.MapReduc
211211
}
212212
return out, nil
213213
}
214+
// cache size of 2000 is arbitrary, but seems to work well mith 600k claims with room for it to grow
214215
cmr, err := hamt.NewCachedMapReduce[Claim, *Claim, []builtin.OwnedClaim](mapper, reducer, 2000)
215216
if err != nil {
216217
return nil, err

0 commit comments

Comments
 (0)