forked from making-choice-personal/volary-opera
/
config.go
42 lines (37 loc) · 1.17 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package brstreamleecher
import (
"time"
"github.com/Fantom-foundation/lachesis-base/gossip/basestream/basestreamleecher/basepeerleecher"
)
type Config struct {
Session basepeerleecher.EpochDownloaderConfig
RecheckInterval time.Duration
BaseProgressWatchdog time.Duration
BaseSessionWatchdog time.Duration
MinSessionRestart time.Duration
MaxSessionRestart time.Duration
}
// DefaultConfig returns default leecher config
func DefaultConfig() Config {
return Config{
Session: basepeerleecher.EpochDownloaderConfig{
DefaultChunkItemsNum: 500,
DefaultChunkItemsSize: 512 * 1024,
ParallelChunksDownload: 6,
RecheckInterval: 10 * time.Millisecond,
},
RecheckInterval: time.Second,
BaseProgressWatchdog: time.Second * 5,
BaseSessionWatchdog: time.Second * 30 * 5,
MinSessionRestart: time.Second * 5,
MaxSessionRestart: time.Minute * 5,
}
}
// LiteConfig returns default leecher config for tests
func LiteConfig() Config {
cfg := DefaultConfig()
cfg.Session.DefaultChunkItemsSize /= 10
cfg.Session.DefaultChunkItemsNum /= 10
cfg.Session.ParallelChunksDownload = cfg.Session.ParallelChunksDownload/2 + 1
return cfg
}