otto 1 year ago
parent
commit
3defe42b9e
  1. 21
      job-master.yaml
  2. 10
      task/task.go

21
job-master.yaml

@ -0,0 +1,21 @@
apiVersion: batch/v1
kind: Job
metadata:
name: hotspot-queue-job
namespace: master
spec:
parallelism: 1
template:
metadata:
name: hotspot-queue-job
spec:
containers:
- name: hotspot-queue-job
image: harbor.homieyy.com/job/master/hotspot-queue:04581463b6917ace4405069e132d6edca8433c6d
command: ["./main"]
env:
- name: JM_ENVIRONMENT
value: master
restartPolicy: OnFailure
imagePullSecrets:
- name: registry-harbor

10
task/task.go

@ -50,7 +50,7 @@ func NewTask() {
ctx := context.Background() ctx := context.Background()
lLen := redisClient.LLen(ctx, hotspotQueueKey).Val() lLen := redisClient.LLen(ctx, hotspotQueueKey).Val()
if lLen == 0 { if lLen == 0 {
fmt.Println("等待") //fmt.Println("等待")
time.Sleep(time.Second * 10) time.Sleep(time.Second * 10)
continue continue
} }
@ -158,10 +158,10 @@ func NewTask() {
// 总人数【一天内】+(实时在线人数/总人数)* 10 = 人数热度值 // 总人数【一天内】+(实时在线人数/总人数)* 10 = 人数热度值
// 总流水【一个星期内】 * 10 = 流水热度值 // 总流水【一个星期内】 * 10 = 流水热度值
//currentOnlineTotal + (todayOnlineTotal * todayOnlineTotal) * 10 //currentOnlineTotal + (todayOnlineTotal * todayOnlineTotal) * 10
fmt.Println("amountTotal:", (todayOnlineTotal*todayOnlineTotal)*10) //fmt.Println("amountTotal:", (todayOnlineTotal*todayOnlineTotal)*10)
fmt.Println("amountTotal:", amountTotal*10) //fmt.Println("amountTotal:", amountTotal*10)
v := value + currentOnlineTotal + (todayOnlineTotal*todayOnlineTotal)*10 + amountTotal*10 v := value + currentOnlineTotal + (todayOnlineTotal*todayOnlineTotal)*10 + amountTotal*10
fmt.Println(v) //fmt.Println(v)
//usecase.logger.Info("实际人数:", onlineTotal) //usecase.logger.Info("实际人数:", onlineTotal)
//usecase.logger.Info("总流水:", amountTotal) //usecase.logger.Info("总流水:", amountTotal)
//usecase.logger.Info("十分钟之前总数:", lastOnlineTotal) //usecase.logger.Info("十分钟之前总数:", lastOnlineTotal)
@ -189,5 +189,5 @@ func NewTask() {
continue continue
} }
} }
fmt.Println("结束") //fmt.Println("结束")
} }

Loading…
Cancel
Save