Align naming about scout raids

This commit is contained in:
9seconds
2026-03-12 19:07:11 +01:00
parent 75392941da
commit d43d6692d7
+11 -11
View File
@@ -10,7 +10,7 @@ import (
const ( const (
DoppelGangerMaxDurations = 4096 DoppelGangerMaxDurations = 4096
DoppelGangerScoutMissionEach = 30 * time.Minute DoppelGangerScoutRaidEach = 30 * time.Minute
DoppelGangerScoutRepeats = 10 DoppelGangerScoutRepeats = 10
) )
@@ -26,8 +26,8 @@ type Ganger struct {
wg sync.WaitGroup wg sync.WaitGroup
scout Scout scout Scout
scoutMissionEach time.Duration scoutRaidEach time.Duration
scoutMissionRepeats int scoutRaidRepeats int
stats *Stats stats *Stats
durations []time.Duration durations []time.Duration
@@ -68,7 +68,7 @@ func (g *Ganger) NewConn(conn essentials.Conn) (Conn, error) {
} }
func (g *Ganger) run() { func (g *Ganger) run() {
scoutTicker := time.NewTicker(g.scoutMissionEach) scoutTicker := time.NewTicker(g.scoutRaidEach)
defer func() { defer func() {
scoutTicker.Stop() scoutTicker.Stop()
@@ -84,7 +84,7 @@ func (g *Ganger) run() {
updatedStatsChan := make(chan *Stats) updatedStatsChan := make(chan *Stats)
g.wg.Go(func() { g.wg.Go(func() {
g.runScoutMission(scoutCollectedChan) g.runScoutRaid(scoutCollectedChan)
}) })
for { for {
@@ -109,7 +109,7 @@ func (g *Ganger) run() {
currentScoutCollectedChan = scoutCollectedChan currentScoutCollectedChan = scoutCollectedChan
case <-scoutTicker.C: case <-scoutTicker.C:
g.wg.Go(func() { g.wg.Go(func() {
g.runScoutMission(scoutCollectedChan) g.runScoutRaid(scoutCollectedChan)
}) })
case req := <-g.connRequests: case req := <-g.connRequests:
select { select {
@@ -120,10 +120,10 @@ func (g *Ganger) run() {
} }
} }
func (g *Ganger) runScoutMission(rvChan chan<- []time.Duration) { func (g *Ganger) runScoutRaid(rvChan chan<- []time.Duration) {
durations := []time.Duration{} durations := []time.Duration{}
for range g.scoutMissionRepeats { for range g.scoutRaidRepeats {
learned, err := g.scout.Learn(g.ctx) learned, err := g.scout.Learn(g.ctx)
if err != nil { if err != nil {
g.logger.WarningError("cannot learn", err) g.logger.WarningError("cannot learn", err)
@@ -150,7 +150,7 @@ func NewGanger(
ctx, cancel := context.WithCancel(ctx) ctx, cancel := context.WithCancel(ctx)
if scoutEach == 0 { if scoutEach == 0 {
scoutEach = DoppelGangerScoutMissionEach scoutEach = DoppelGangerScoutRaidEach
} }
if scoutRepeats == 0 { if scoutRepeats == 0 {
@@ -161,8 +161,8 @@ func NewGanger(
ctx: ctx, ctx: ctx,
ctxCancel: cancel, ctxCancel: cancel,
logger: logger, logger: logger,
scoutMissionEach: scoutEach, scoutRaidEach: scoutEach,
scoutMissionRepeats: scoutRepeats, scoutRaidRepeats: scoutRepeats,
stats: &Stats{ stats: &Stats{
k: StatsDefaultK, k: StatsDefaultK,
lambda: StatsDefaultLambda, lambda: StatsDefaultLambda,