/
chart.go
45 lines (39 loc) · 1.03 KB
/
chart.go
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
44
45
/*---------------------------------------------------------------------------------------------
* Copyright (c) IBAX. All rights reserved.
* See LICENSE in the project root for license information.
*--------------------------------------------------------------------------------------------*/
package get_data
import (
"github.com/IBAX-io/go-explorer/models"
)
type Chart struct {
Signal chan bool
}
func (p *Chart) SendSignal() {
select {
case p.Signal <- true:
default:
//If there is still unprocessed content in the channel, not continue to send
}
}
func (p *Chart) ReceiveSignal() {
if p.Signal == nil {
p.Signal = make(chan bool)
}
for {
select {
case <-p.Signal:
models.ChartWG.Wait()
chartDataServer()
}
}
}
func chartDataServer() {
go models.GetDashboardChartDataToRedis()
go models.GetEcoLibsChartDataToRedis()
go models.GetEcoLibsTxChartDataToRedis()
go models.Get15DayBlockDiffChartDataToRedis()
go models.InsertDailyActiveReport()
go models.InsertDailyNodeReport()
go models.DataChartHistoryServer()
}