Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory manager config #1778

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: patch
---

# Don't return an error when a v1 contract doesn't contain any sectors to prune
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: patch
---

# Fix memory manager for downloads using the uploads config
9 changes: 4 additions & 5 deletions bus/pruning.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ func (b *Bus) pruneContractV1(ctx context.Context, rk types.PrivateKey, cm api.C
indices = filtered
return indices, nil
})

var pruneErr string
if err != nil && !errors.Is(err, rhp2.ErrNoSectorsToPrune) && !errors.Is(err, context.Canceled) {
return api.ContractPruneResponse{}, err
} else if err != nil && !errors.Is(err, rhp2.ErrNoSectorsToPrune) {
pruneErr = err.Error()
}

// record spending
Expand All @@ -56,11 +60,6 @@ func (b *Bus) pruneContractV1(ctx context.Context, rk types.PrivateKey, cm api.C
})
}

var pruneErr string
if err != nil {
pruneErr = err.Error()
}

return api.ContractPruneResponse{
ContractSize: rev.Filesize,
Pruned: pruned,
Expand Down
4 changes: 2 additions & 2 deletions worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,8 @@ func New(cfg config.Worker, masterKey [32]byte, b Bus, l *zap.Logger) (*Worker,
hm := hosts.NewManager(w.masterKey, w.accounts, w.contractSpendingRecorder, dialer, l)
w.hostManager = hm

dlmm := memory.NewManager(cfg.UploadMaxMemory, l.Named("uploadmanager"))
w.downloadManager = download.NewManager(w.shutdownCtx, &uploadKey, hm, dlmm, w.bus, cfg.UploadMaxOverdrive, cfg.UploadOverdriveTimeout, l)
dlmm := memory.NewManager(cfg.DownloadMaxMemory, l.Named("downloadmanager"))
w.downloadManager = download.NewManager(w.shutdownCtx, &uploadKey, hm, dlmm, w.bus, cfg.DownloadMaxOverdrive, cfg.DownloadOverdriveTimeout, l)

ulmm := memory.NewManager(cfg.UploadMaxMemory, l.Named("uploadmanager"))
w.uploadManager = upload.NewManager(w.shutdownCtx, &uploadKey, hm, ulmm, w.bus, w.bus, w.bus, cfg.UploadMaxOverdrive, cfg.UploadOverdriveTimeout, l)
Expand Down
Loading