emailer configurable interval
This commit is contained in:
17
main.go
17
main.go
@@ -21,16 +21,15 @@ var stateFinder = regexp.MustCompile(`[A-Za-z]+`)
|
||||
func main() {
|
||||
lock := &sync.Mutex{}
|
||||
go func() {
|
||||
c := time.NewTicker(time.Minute)
|
||||
for range c.C {
|
||||
if !config.Get().EmailerEnabled {
|
||||
continue
|
||||
for {
|
||||
if config.Get().EmailerEnabled {
|
||||
lock.Lock()
|
||||
if err := email(); err != nil {
|
||||
log.Print(err)
|
||||
}
|
||||
lock.Unlock()
|
||||
}
|
||||
lock.Lock()
|
||||
if err := email(); err != nil {
|
||||
log.Print(err)
|
||||
}
|
||||
lock.Unlock()
|
||||
time.Sleep(config.Get().Interval.Email.Get())
|
||||
}
|
||||
}()
|
||||
if err := _main(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user