Skip to content

Commit f2d6c9f

Browse files
author
zouyi
committed
pop add topic
1 parent 83bf252 commit f2d6c9f

File tree

7 files changed

+6
-4
lines changed

7 files changed

+6
-4
lines changed

build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [[ `uname -s` == "Darwin" ]]; then
55
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags '-w' -o dist/delay-queue-win-64
66
go build -ldflags '-w' -o dist/delay-queue-macos-64
77
else
8-
echo "system is macos"
8+
echo "system is linux"
99
CGO_ENABLED=0 GOOS=macos GOARCH=amd64 go build -ldflags '-w' -o dist/delay-queue-linux-64
1010
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags '-w' -o dist/delay-queue-win-64
1111
go build -ldflags '-w' -o dist/delay-queue-macos-64

delayqueue/delay_queue.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func initTimers() {
143143
var bucketName string
144144
for i := 0; i < config.Setting.BucketSize; i++ {
145145

146-
// 每 1s 执行一次
146+
// 每 1s 执行一次
147147
timers[i] = time.NewTicker(1 * time.Second)
148148

149149
// 如果这里部署多实例的话,就会产生竞争

delayqueue/job.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ type Job struct {
1010
Topic string `json:"topic" msgpack:"1"` // topic ,唯一
1111
Id string `json:"id" msgpack:"2"` // job唯一标识ID 。客户端需要保证唯一性。有关联关系的
1212
Delay int64 `json:"delay" msgpack:"3"` // 延迟时间, unix时间戳
13-
TTR int64 `json:"ttr" msgpack:"4"` // 超时时间,TTR的设计目的是为了保证消息传输的可靠性。
14-
Body string `json:"body" msgpack:"5"`// body
13+
TTR int64 `json:"ttr" msgpack:"4"` // 超时时间,TTR的设计目的是为了保证消息传输的可靠性。
14+
Body string `json:"body" msgpack:"5"` // body
1515
}
1616

1717
// 获取Job

dist/delay-queue-linux-64

84 Bytes
Binary file not shown.

dist/delay-queue-macos-64

-8 KB
Binary file not shown.

dist/delay-queue-win-64

-512 Bytes
Binary file not shown.

routers/routers.go

+2
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@ func Pop(resp http.ResponseWriter, req *http.Request) {
9090
}
9191

9292
type Data struct {
93+
Topic string `json:"topic"`
9394
Id string `json:"id"`
9495
Body string `json:"body"`
9596
}
9697

9798
data := Data{
9899
Id: job.Id,
100+
Topic: job.Topic,
99101
Body: job.Body,
100102
}
101103

0 commit comments

Comments
 (0)