Skip to content

Commit

Permalink
add free check (#1315)
Browse files Browse the repository at this point in the history
  • Loading branch information
LexLuthr authored Mar 22, 2023
1 parent e25ff0d commit ac00c75
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions storagemanager/storagemanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ func (m *StorageManager) Free(ctx context.Context) (uint64, error) {
return 0, fmt.Errorf("getting total tagged: %w", err)
}

//Return 0 if user sets this value to lower than currently occupied by deals
if m.Cfg.MaxStagingDealsBytes < tagged {
return 0, nil
}

return m.Cfg.MaxStagingDealsBytes - tagged, nil
}

Expand Down

0 comments on commit ac00c75

Please sign in to comment.