Rename the tick variable

This commit is contained in:
Marc Di Luzio 2020-07-07 18:24:16 +01:00
parent 3493d51d36
commit 5928dfdb20

View file

@ -36,9 +36,9 @@ type Server struct {
grpcServ *grpc.Server grpcServ *grpc.Server
// Config settings // Config settings
address string address string
persistence int persistence int
tick int minutesPerTick int
// sync point for sub-threads // sync point for sub-threads
sync sync.WaitGroup sync sync.WaitGroup
@ -68,7 +68,7 @@ func OptionPersistentData() ServerOption {
// 0 means no automatic server tick // 0 means no automatic server tick
func OptionTick(minutes int) ServerOption { func OptionTick(minutes int) ServerOption {
return func(s *Server) { return func(s *Server) {
s.tick = minutes s.minutesPerTick = minutes
} }
} }
@ -124,8 +124,8 @@ func (s *Server) Run() {
defer s.sync.Done() defer s.sync.Done()
// Set up the schedule if requested // Set up the schedule if requested
if s.tick != 0 { if s.minutesPerTick != 0 {
if err := s.schedule.AddFunc(fmt.Sprintf("0 */%d * * *", s.tick), func() { if err := s.schedule.AddFunc(fmt.Sprintf("0 */%d * * *", s.minutesPerTick), func() {
// Ensure we don't quit during this function // Ensure we don't quit during this function
s.sync.Add(1) s.sync.Add(1)
defer s.sync.Done() defer s.sync.Done()