|
|
@@ -10,7 +10,7 @@ import (
|
|
10
|
10
|
|
|
11
|
11
|
const (
|
|
12
|
12
|
DoppelGangerMaxDurations = 4096
|
|
13
|
|
- DoppelGangerScoutMissionEach = 30 * time.Minute
|
|
|
13
|
+ DoppelGangerScoutRaidEach = 30 * time.Minute
|
|
14
|
14
|
DoppelGangerScoutRepeats = 10
|
|
15
|
15
|
)
|
|
16
|
16
|
|
|
|
@@ -26,8 +26,8 @@ type Ganger struct {
|
|
26
|
26
|
wg sync.WaitGroup
|
|
27
|
27
|
|
|
28
|
28
|
scout Scout
|
|
29
|
|
- scoutMissionEach time.Duration
|
|
30
|
|
- scoutMissionRepeats int
|
|
|
29
|
+ scoutRaidEach time.Duration
|
|
|
30
|
+ scoutRaidRepeats int
|
|
31
|
31
|
|
|
32
|
32
|
stats *Stats
|
|
33
|
33
|
durations []time.Duration
|
|
|
@@ -68,7 +68,7 @@ func (g *Ganger) NewConn(conn essentials.Conn) (Conn, error) {
|
|
68
|
68
|
}
|
|
69
|
69
|
|
|
70
|
70
|
func (g *Ganger) run() {
|
|
71
|
|
- scoutTicker := time.NewTicker(g.scoutMissionEach)
|
|
|
71
|
+ scoutTicker := time.NewTicker(g.scoutRaidEach)
|
|
72
|
72
|
defer func() {
|
|
73
|
73
|
scoutTicker.Stop()
|
|
74
|
74
|
|
|
|
@@ -84,7 +84,7 @@ func (g *Ganger) run() {
|
|
84
|
84
|
updatedStatsChan := make(chan *Stats)
|
|
85
|
85
|
|
|
86
|
86
|
g.wg.Go(func() {
|
|
87
|
|
- g.runScoutMission(scoutCollectedChan)
|
|
|
87
|
+ g.runScoutRaid(scoutCollectedChan)
|
|
88
|
88
|
})
|
|
89
|
89
|
|
|
90
|
90
|
for {
|
|
|
@@ -109,7 +109,7 @@ func (g *Ganger) run() {
|
|
109
|
109
|
currentScoutCollectedChan = scoutCollectedChan
|
|
110
|
110
|
case <-scoutTicker.C:
|
|
111
|
111
|
g.wg.Go(func() {
|
|
112
|
|
- g.runScoutMission(scoutCollectedChan)
|
|
|
112
|
+ g.runScoutRaid(scoutCollectedChan)
|
|
113
|
113
|
})
|
|
114
|
114
|
case req := <-g.connRequests:
|
|
115
|
115
|
select {
|
|
|
@@ -120,10 +120,10 @@ func (g *Ganger) run() {
|
|
120
|
120
|
}
|
|
121
|
121
|
}
|
|
122
|
122
|
|
|
123
|
|
-func (g *Ganger) runScoutMission(rvChan chan<- []time.Duration) {
|
|
|
123
|
+func (g *Ganger) runScoutRaid(rvChan chan<- []time.Duration) {
|
|
124
|
124
|
durations := []time.Duration{}
|
|
125
|
125
|
|
|
126
|
|
- for range g.scoutMissionRepeats {
|
|
|
126
|
+ for range g.scoutRaidRepeats {
|
|
127
|
127
|
learned, err := g.scout.Learn(g.ctx)
|
|
128
|
128
|
if err != nil {
|
|
129
|
129
|
g.logger.WarningError("cannot learn", err)
|
|
|
@@ -150,7 +150,7 @@ func NewGanger(
|
|
150
|
150
|
ctx, cancel := context.WithCancel(ctx)
|
|
151
|
151
|
|
|
152
|
152
|
if scoutEach == 0 {
|
|
153
|
|
- scoutEach = DoppelGangerScoutMissionEach
|
|
|
153
|
+ scoutEach = DoppelGangerScoutRaidEach
|
|
154
|
154
|
}
|
|
155
|
155
|
|
|
156
|
156
|
if scoutRepeats == 0 {
|
|
|
@@ -161,8 +161,8 @@ func NewGanger(
|
|
161
|
161
|
ctx: ctx,
|
|
162
|
162
|
ctxCancel: cancel,
|
|
163
|
163
|
logger: logger,
|
|
164
|
|
- scoutMissionEach: scoutEach,
|
|
165
|
|
- scoutMissionRepeats: scoutRepeats,
|
|
|
164
|
+ scoutRaidEach: scoutEach,
|
|
|
165
|
+ scoutRaidRepeats: scoutRepeats,
|
|
166
|
166
|
stats: &Stats{
|
|
167
|
167
|
k: StatsDefaultK,
|
|
168
|
168
|
lambda: StatsDefaultLambda,
|