mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 09:05:55 +00:00
fix unrelated data race that randomly cropped up in CI
This commit is contained in:
parent
3d3080df8b
commit
b0d29bb425
1 changed files with 4 additions and 1 deletions
5
api.go
5
api.go
|
|
@ -996,7 +996,10 @@ func (api *API) Usage(ctx context.Context, remote bool) (map[string]NodeUsage, e
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
if api.usageCache.lastCalcDuration < usageCacheMinDuration {
|
||||
api.usageCache.muAssign.Lock()
|
||||
lastCalc := api.usageCache.lastCalcDuration
|
||||
api.usageCache.muAssign.Unlock()
|
||||
if lastCalc < usageCacheMinDuration {
|
||||
err := api.ResetUsageCache()
|
||||
if err != nil {
|
||||
api.server.logger.Infof("could not reset usageCache: %s", err)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue