MCPcopy Create free account
hub / github.com/ZeppelinMC/Zeppelin / SetFrequency

Method SetFrequency

server/tick/tick.go:39–60  ·  view source on GitHub ↗
(tps int)

Source from the content-addressed store, hash-verified

37}
38
39func (mgr *TickManager) SetFrequency(tps int) error {
40 mgr.mu.RLock()
41 defer mgr.mu.RUnlock()
42
43 if tps == 0 {
44 return fmt.Errorf("0 tps is not allowed. Use mgr.Freeze instead")
45 }
46
47 d := time.Second / time.Duration(tps)
48 mgr.d.Store(int64(d))
49
50 for _, ticker := range mgr.tickers {
51 ticker.Reset(d)
52 }
53
54 /*mgr.b.Range(func(u uuid.UUID, s session.Session) bool {
55 s.SetTickState(float32(tps), false)
56 return true
57 })*/
58
59 return nil
60}
61
62func (mgr *TickManager) Freeze() {
63 for _, ticker := range mgr.tickers {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected