GiB to Bytes

This commit is contained in:
Anton Evangelatov 2021-09-06 15:52:25 +02:00
parent c69d1db1eb
commit 0b7793a927
3 changed files with 8 additions and 9 deletions

View File

@ -253,11 +253,11 @@ message`,
as a multiplier of the minimum collateral bound`, as a multiplier of the minimum collateral bound`,
}, },
{ {
Name: "MaxStagingDealsGiB", Name: "MaxStagingDealsBytes",
Type: "int64", Type: "int64",
Comment: `The maximum size of staging deals not yet passed to the sealing node, Comment: `The maximum allowed disk usage size in bytes of staging deals not yet
that the markets service can accept`, passed to the sealing node by the markets service`,
}, },
{ {
Name: "SimultaneousTransfers", Name: "SimultaneousTransfers",

View File

@ -126,9 +126,9 @@ type DealmakingConfig struct {
// The maximum collateral that the provider will put up against a deal, // The maximum collateral that the provider will put up against a deal,
// as a multiplier of the minimum collateral bound // as a multiplier of the minimum collateral bound
MaxProviderCollateralMultiplier uint64 MaxProviderCollateralMultiplier uint64
// The maximum size of staging deals not yet passed to the sealing node, // The maximum allowed disk usage size in bytes of staging deals not yet
// that the markets service can accept // passed to the sealing node by the markets service
MaxStagingDealsGiB int64 MaxStagingDealsBytes int64
// The maximum number of parallel online data transfers (storage+retrieval) // The maximum number of parallel online data transfers (storage+retrieval)
SimultaneousTransfers uint64 SimultaneousTransfers uint64

View File

@ -542,9 +542,8 @@ func BasicDealFilter(cfg config.DealmakingConfig, user dtypes.StorageDealFilter)
return false, "miner error", err return false, "miner error", err
} }
diskUsageGiB := diskUsageBytes / 1024 / 1024 / 1024 if cfg.MaxStagingDealsBytes != 0 && diskUsageBytes >= cfg.MaxStagingDealsBytes {
if cfg.MaxStagingDealsGiB != 0 && diskUsageGiB >= cfg.MaxStagingDealsGiB { log.Errorw("proposed deal rejected because there are too many deals in the staging area at the moment", "MaxStagingDealsBytes", cfg.MaxStagingDealsBytes, "DiskUsageBytes", diskUsageBytes)
log.Errorw("proposed deal rejected because there are too many deals in the staging area at the moment", "MaxStagingDealsGiB", cfg.MaxStagingDealsGiB, "DiskUsageGiB", diskUsageGiB)
return false, "cannot accept deal as miner is overloaded at the moment - there are too many staging deals being processed", nil return false, "cannot accept deal as miner is overloaded at the moment - there are too many staging deals being processed", nil
} }