-
Notifications
You must be signed in to change notification settings - Fork 21
/
db_test.go
50 lines (48 loc) · 1.07 KB
/
db_test.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
46
47
48
49
50
package main
import (
"testing"
)
func TestPutTmpShare(t *testing.T) {
//conf := parseConfig()
//db := initDB(conf)
//login := "123"
//agent := "321"
//ch := time.After(10 * time.Minute)
//for {
// select {
// case <-ch:
// goto SUM
// default:
// time.Sleep(10*time.Second)
// db.putTmpShare(login, agent, 5000)
// }
//}
//
//SUM:
//
//db.client.ZRemRangeByScore("tmp:"+login+":"+agent, "-inf", fmt.Sprint("(", time.Now().UnixNano()-10*time.Minute.Nanoseconds()))
//l, err := db.client.ZRangeWithScores("tmp:"+login+":"+agent, 0, -1).Result()
//if err != nil {
// logger.Error(err)
//}
//
//logger.Info(l)
//
//var sum int64
//for _, z := range l {
// str := z.Member.(string)
// li := strings.Split(str, ":")
// logger.Info(li)
// i, err := strconv.Atoi(li[0])
// if err != nil {
// logger.Error(err)
// }
// sum = sum + int64(i)
//}
//logger.Info(sum)
//logger.Info(time.Minute.Seconds())
//logger.Info(int64(db.conf.Node.BlockTime))
////H = D / ΔT
//averageHashrate := sum / (10 * int64(time.Minute.Seconds()))
//logger.Info(averageHashrate)
}