Skip to content

Commit 92925c3

Browse files
committed
chore: update example
Signed-off-by: Bo-Yi Wu <[email protected]>
1 parent 9244a52 commit 92925c3

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

_example/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ module example
33
go 1.16
44

55
require (
6-
github.com/golang-queue/nsq v0.0.2-0.20210822032808-c373e18f518d
7-
github.com/golang-queue/queue v0.0.7
6+
github.com/golang-queue/nsq v0.0.3-0.20210905090550-9244a526d0b7
7+
github.com/golang-queue/queue v0.0.8-0.20210905095503-cc99dff8fdc3
88
)

_example/go.sum

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
22
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
33
github.com/golang-queue/nsq v0.0.2-0.20210822032808-c373e18f518d h1:xehJNG7VCLtO8R++fkgfCm/cMlxiYZwVsKY4CJwINmE=
44
github.com/golang-queue/nsq v0.0.2-0.20210822032808-c373e18f518d/go.mod h1:1Q/8y4BclWLj03sn0dApJIObatC3qMX5gLjlbo0TwXs=
5+
github.com/golang-queue/nsq v0.0.3-0.20210905090550-9244a526d0b7 h1:lMHAkoYeCPLp4o8uM+GQ6ijr/opJRWorDK7M7caI/3k=
6+
github.com/golang-queue/nsq v0.0.3-0.20210905090550-9244a526d0b7/go.mod h1:I2JzRTV5lLsgu/R6c4SXjPt8ZhyX/lsV8bhjTZP9yu0=
57
github.com/golang-queue/queue v0.0.7 h1:WENCPyPBcIWYgBFSAZ8USGtwmxeCeMkhjwuyM0MAi84=
68
github.com/golang-queue/queue v0.0.7/go.mod h1:JS5tYJacahCjafcplU5idNLX2vkYioqh6wEDX5o9Nms=
9+
github.com/golang-queue/queue v0.0.8-0.20210905085819-3cd1dfe014e2/go.mod h1:JS5tYJacahCjafcplU5idNLX2vkYioqh6wEDX5o9Nms=
10+
github.com/golang-queue/queue v0.0.8-0.20210905095503-cc99dff8fdc3 h1:ka4/BRgVndDi92gaeOpjnnfuUXrWr1y87x/Go9M3x3Y=
11+
github.com/golang-queue/queue v0.0.8-0.20210905095503-cc99dff8fdc3/go.mod h1:JS5tYJacahCjafcplU5idNLX2vkYioqh6wEDX5o9Nms=
712
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
813
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
914
github.com/nsqio/go-nsq v1.0.8 h1:3L2F8tNLlwXXlp2slDUrUWSBn2O3nMh8R1/KEDFTHPk=

_example/main.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7-
"log"
87
"time"
98

109
"github.com/golang-queue/nsq"
@@ -48,13 +47,11 @@ func main() {
4847
)
4948

5049
// define the queue
51-
q, err := queue.NewQueue(
52-
queue.WithWorkerCount(10),
50+
q := queue.NewPool(
51+
10,
5352
queue.WithWorker(w),
5453
)
55-
if err != nil {
56-
log.Fatal(err)
57-
}
54+
defer q.Release()
5855

5956
// start the five worker
6057
q.Start()
@@ -73,9 +70,4 @@ func main() {
7370
fmt.Println("message:", <-rets)
7471
time.Sleep(50 * time.Millisecond)
7572
}
76-
77-
// shutdown the service and notify all the worker
78-
q.Shutdown()
79-
// wait all jobs are complete.
80-
q.Wait()
8173
}

0 commit comments

Comments
 (0)