-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel.go
41 lines (34 loc) · 846 Bytes
/
model.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
package delayq
import "fmt"
type RedisConfiguration struct {
Host string
Port string
}
type Job struct {
Topic string
ID string
Delay int64
MaxRetry int64
RetryCount int64
TTR int64
Boday []byte
}
var (
RedisDelayQueue = "delayq:dq"
RedisJobPool = "delayq:jp"
RedisReadyQueue = "delayq:rq"
RedisProcessQueue = "delayq:process"
serverClosed uint32 = 1
)
func getProcessQueueKey(topic string) string {
return fmt.Sprintf("%s:%s", RedisProcessQueue, topic)
}
func getDelayQueueKey(topic string) string {
return fmt.Sprintf("%s:%s", RedisDelayQueue, topic)
}
func getReadyQueueKey(topic string) string {
return fmt.Sprintf("%s:%s", RedisReadyQueue, topic)
}
func getJobPoolKey(topic string) string {
return fmt.Sprintf("%s:%s", RedisJobPool, topic)
}