switch DAGStoreConfig#GCInterval to Duration type.

This commit is contained in:
Raúl Kripalani 2021-08-04 12:20:51 +01:00
parent 35895e897a
commit 583a3c6277
4 changed files with 14 additions and 13 deletions

View File

@ -90,7 +90,7 @@ func NewDAGStore(cfg config.DAGStoreConfig, mountApi MinerAPI) (*dagstore.DAGSto
mountApi: mountApi,
failureCh: failureCh,
traceCh: traceCh,
gcInterval: time.Duration(cfg.GCIntervalMillis) * time.Millisecond,
gcInterval: time.Duration(cfg.GCInterval),
}
return dagst, w, nil

View File

@ -29,10 +29,10 @@ func TestWrapperAcquireRecovery(t *testing.T) {
// Create a DAG store wrapper
dagst, w, err := NewDAGStore(config.DAGStoreConfig{
TransientsDir: t.TempDir(),
IndexDir: t.TempDir(),
DatastoreDir: t.TempDir(),
GCIntervalMillis: 1,
TransientsDir: t.TempDir(),
IndexDir: t.TempDir(),
DatastoreDir: t.TempDir(),
GCInterval: config.Duration(1 * time.Millisecond),
}, mockLotusMount{})
require.NoError(t, err)
@ -82,10 +82,10 @@ func TestWrapperBackground(t *testing.T) {
// Create a DAG store wrapper
dagst, w, err := NewDAGStore(config.DAGStoreConfig{
TransientsDir: t.TempDir(),
IndexDir: t.TempDir(),
DatastoreDir: t.TempDir(),
GCIntervalMillis: 1,
TransientsDir: t.TempDir(),
IndexDir: t.TempDir(),
DatastoreDir: t.TempDir(),
GCInterval: config.Duration(1 * time.Millisecond),
}, mockLotusMount{})
require.NoError(t, err)

View File

@ -195,7 +195,7 @@ func DefaultStorageMiner() *StorageMiner {
MaxConcurrentIndex: 5,
MaxConcurrentReadyFetches: 2,
MaxConcurrencyStorageCalls: 100,
GCIntervalMillis: 60000,
GCInterval: Duration(1 * time.Minute),
},
}
cfg.Common.API.ListenAddress = "/ip4/127.0.0.1/tcp/2345/http"

View File

@ -86,9 +86,10 @@ type DAGStoreConfig struct {
// Default value: 100.
MaxConcurrencyStorageCalls int
// The number of milliseconds between calls to periodic dagstore GC.
// Default value: 60000 (60 seconds = 1 minute).
GCIntervalMillis int
// The time between calls to periodic dagstore GC, in time.Duration string
// representation, e.g. 1m, 5m, 1h.
// Default value: 1 minute.
GCInterval Duration
}
type MinerSubsystemConfig struct {