-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
43 lines (36 loc) · 769 Bytes
/
main.go
File metadata and controls
43 lines (36 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"fmt"
"log"
"sync"
"time"
"github.com/Chainflow/SCRT/config"
"github.com/Chainflow/SCRT/server"
)
func main() {
cfg, err := config.ReadConfigFromFile()
if err != nil {
log.Fatal(err)
}
var wg sync.WaitGroup
wg.Add(1)
// Calling go routine to send alerts for missed blocks
go func() {
for {
if err := server.SendSingleMissedBlockAlert(cfg); err != nil {
fmt.Println("Error while sending missed block alerts", err)
}
time.Sleep(4 * time.Second)
}
}()
// Calling go routine to send alert about validator status
go func() {
for {
if err := server.ValidatorStatusAlert(cfg); err != nil {
fmt.Println("Error while sending jailed alerts", err)
}
time.Sleep(60 * time.Second)
}
}()
wg.Wait()
}