Skip to content

Commit 3f86820

Browse files
committed
config: #12 customized snap interval
1 parent 31c8bb0 commit 3f86820

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/config/config.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ var (
1919
)
2020

2121
type appConfig struct {
22-
LogLevel logrus.Level
22+
LogLevel logrus.Level
23+
SnapRestSeconds uint32
2324

2425
*UploadConfig
2526
*PlatformConfig

src/monitor/monitor.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"sync/atomic"
55
"time"
66

7+
"github.com/go-olive/olive/src/config"
78
"github.com/go-olive/olive/src/dispatcher"
89
"github.com/go-olive/olive/src/engine"
910
"github.com/go-olive/olive/src/enum"
@@ -100,7 +101,7 @@ func (m *monitor) refresh() {
100101

101102
func (m *monitor) run() {
102103
t := jitterbug.New(
103-
time.Second*15,
104+
time.Second*time.Duration(config.APP.SnapRestSeconds),
104105
&jitterbug.Norm{Stdev: time.Second * 3},
105106
)
106107
defer t.Stop()

src/tmpl/config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
LogLevel = 5
2+
SnapRestSeconds = 15
23

34
[UploadConfig]
45
Enable = false

0 commit comments

Comments
 (0)