Skip to content

Commit cec209f

Browse files
committed
Merge tag 'v0.2.5'
2 parents f84f9f2 + 92f53f2 commit cec209f

26 files changed

+1065
-504
lines changed

.circleci/config.yml

Lines changed: 48 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,49 @@
1-
version: 2
1+
version: 2.1
22
jobs:
3-
redis5:
3+
redis:
4+
parameters:
5+
redis-image:
6+
type: string
7+
go-image:
8+
type: string
49
docker:
5-
- image: circleci/golang:1.16
10+
- image: << parameters.go-image >>
611
environment:
712
- GO111MODULE=on
8-
- image: redis:5-alpine
13+
- image: << parameters.redis-image >>
914
working_directory: /go/src/github.com/taylorchu/work
1015
steps:
1116
- checkout
1217
- run: dockerize -wait tcp://:6379
1318
- run: go test -p 1 -v ./...
14-
redis5-cluster:
19+
redis-cluster:
20+
parameters:
21+
redis-image:
22+
type: string
23+
go-image:
24+
type: string
1525
docker:
16-
- image: circleci/golang:1.16
26+
- image: << parameters.go-image >>
1727
environment:
1828
- GO111MODULE=on
1929
- REDIS_ADDR=:7000,:7001,:7002
20-
- image: redis:5-alpine
30+
- image: << parameters.redis-image >>
2131
command:
2232
- --cluster-enabled
2333
- "yes"
2434
- --port
2535
- "7000"
2636
- --cluster-config-file
2737
- 7000.conf
28-
- image: redis:5-alpine
38+
- image: << parameters.redis-image >>
2939
command:
3040
- --cluster-enabled
3141
- "yes"
3242
- --port
3343
- "7001"
3444
- --cluster-config-file
3545
- 7001.conf
36-
- image: redis:5-alpine
46+
- image: << parameters.redis-image >>
3747
command:
3848
- --cluster-enabled
3949
- "yes"
@@ -45,74 +55,42 @@ jobs:
4555
steps:
4656
- checkout
4757
- run: dockerize -wait tcp://:7000 -wait tcp://:7001 -wait tcp://:7002
48-
- run: sudo apt-get install redis-tools
58+
- run: sudo apt-get update && sudo apt-get install redis-tools
4959
- run: echo yes | redis-cli --cluster create 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002
5060
- run: go test -p 1 -v ./...
51-
redis6:
61+
fossa:
5262
docker:
53-
- image: circleci/golang:1.16
54-
environment:
55-
- GO111MODULE=on
56-
- image: redis:6-alpine
63+
- image: alpine
5764
working_directory: /go/src/github.com/taylorchu/work
5865
steps:
5966
- checkout
60-
- run: dockerize -wait tcp://:6379
61-
- run: go test -p 1 -v ./...
62-
redis6-cluster:
63-
docker:
64-
- image: circleci/golang:1.16
65-
environment:
66-
- GO111MODULE=on
67-
- REDIS_ADDR=:7000,:7001,:7002
68-
- image: redis:6-alpine
69-
command:
70-
- --cluster-enabled
71-
- "yes"
72-
- --port
73-
- "7000"
74-
- --cluster-config-file
75-
- 7000.conf
76-
- image: redis:6-alpine
77-
command:
78-
- --cluster-enabled
79-
- "yes"
80-
- --port
81-
- "7001"
82-
- --cluster-config-file
83-
- 7001.conf
84-
- image: redis:6-alpine
85-
command:
86-
- --cluster-enabled
87-
- "yes"
88-
- --port
89-
- "7002"
90-
- --cluster-config-file
91-
- 7002.conf
92-
working_directory: /go/src/github.com/taylorchu/work
93-
steps:
94-
- checkout
95-
- run: dockerize -wait tcp://:7000 -wait tcp://:7001 -wait tcp://:7002
96-
- run: sudo apt-get install redis-tools
97-
- run: echo yes | redis-cli --cluster create 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002
98-
- run: go test -p 1 -v ./...
99-
keydb:
100-
docker:
101-
- image: circleci/golang:1.16
102-
environment:
103-
- GO111MODULE=on
104-
- image: eqalpha/keydb
105-
working_directory: /go/src/github.com/taylorchu/work
106-
steps:
107-
- checkout
108-
- run: dockerize -wait tcp://:6379
109-
- run: go test -p 1 -v ./...
67+
- run: apk add --no-cache curl bash
68+
- run: |
69+
curl -H 'Cache-Control: no-cache' https://raw.githubusercontent.com/fossas/fossa-cli/master/install-latest.sh | bash
70+
- run: fossa analyze
71+
- run: fossa test
11072
workflows:
11173
version: 2
11274
build_and_test:
11375
jobs:
114-
- redis5
115-
- redis6
116-
- redis5-cluster
117-
- redis6-cluster
118-
- keydb
76+
- redis:
77+
matrix:
78+
parameters:
79+
go-image:
80+
- circleci/golang:1.17
81+
- circleci/golang:1.16
82+
redis-image:
83+
- redis:5-alpine
84+
- redis:6-alpine
85+
- eqalpha/keydb
86+
- redis-cluster:
87+
matrix:
88+
parameters:
89+
go-image:
90+
- circleci/golang:1.17
91+
- circleci/golang:1.16
92+
redis-image:
93+
- redis:5-alpine
94+
- redis:6-alpine
95+
- eqalpha/keydb
96+
- fossa

README.md

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,48 @@
22

33
[![GoDoc](https://godoc.org/github.com/taylorchu/work?status.png)](https://godoc.org/github.com/taylorchu/work)
44
[![Go Report Card](https://goreportcard.com/badge/github.com/taylorchu/work)](https://goreportcard.com/report/github.com/taylorchu/work)
5-
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Ftaylorchu%2Fwork.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Ftaylorchu%2Fwork?ref=badge_shield)
5+
[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B4257%2Fgit%40github.com%3Ataylorchu%2Fwork.git.svg?type=shield)](https://app.fossa.com/projects/custom%2B4257%2Fgit%40github.com%3Ataylorchu%2Fwork.git?ref=badge_shield)
66
[![CircleCI](https://circleci.com/gh/taylorchu/work.svg?style=svg)](https://circleci.com/gh/taylorchu/work)
77

88
Please see `cmd/` for enqueuer and worker demo.
99

1010
## Improvements
1111

1212
- [x] queue backend abstraction
13-
- redis is still the default, but the new design allows custom queue implementation.
13+
- redis is still the default, but the new design allows custom queue implementation.
1414
- [x] simplify the keyspace design of redis queue backend
15-
- The new design uses 1 redis hash per job, and 1 redis sorted set for queue.
16-
- [Interesting read](https://kirshatrov.com/2018/07/20/redis-job-queue/)
15+
- The new design uses 1 redis hash per job, and 1 redis sorted set for queue.
16+
- [Interesting read](https://kirshatrov.com/2018/07/20/redis-job-queue/)
1717
- [x] modular
18-
- The core only catches panics, retries on failure, and waits if a queue is empty.
19-
- All other [functionalities](https://kirshatrov.com/2019/01/03/state-of-background-jobs/)
20-
are either removed or moved to separate middlewares.
18+
- The core only catches panics, retries on failure, and waits if a queue is empty.
19+
- All other [functionalities](https://kirshatrov.com/2019/01/03/state-of-background-jobs/)
20+
are either removed or moved to separate middlewares.
2121
- [x] support binary payload/args with message pack.
2222
- [x] replace built-in UI with prometheus metrics (use grafana if you want dashboard).
2323
- [x] additional optimizations (alloc + bulk queue ops)
24-
```go
25-
BenchmarkWorkerRunJob/work_v1_1-8 3000 515957 ns/op
26-
BenchmarkWorkerRunJob/work_v2_1-8 5000 284516 ns/op
27-
BenchmarkWorkerRunJob/work_v1_10-8 1000 2136546 ns/op
28-
BenchmarkWorkerRunJob/work_v2_10-8 5000 367997 ns/op
29-
BenchmarkWorkerRunJob/work_v1_100-8 100 18234023 ns/op
30-
BenchmarkWorkerRunJob/work_v2_100-8 1000 1759186 ns/op
31-
BenchmarkWorkerRunJob/work_v1_1000-8 10 162110100 ns/op
32-
BenchmarkWorkerRunJob/work_v2_1000-8 100 12646080 ns/op
33-
BenchmarkWorkerRunJob/work_v1_10000-8 1 1691287122 ns/op
34-
BenchmarkWorkerRunJob/work_v2_10000-8 10 144923087 ns/op
35-
BenchmarkWorkerRunJob/work_v1_100000-8 1 17515722574 ns/op
36-
BenchmarkWorkerRunJob/work_v2_100000-8 1 1502468637 ns/op
37-
PASS
38-
ok github.com/taylorchu/work 87.901s
39-
```
40-
- [ ] http enqueuer
41-
24+
```go
25+
BenchmarkWorkerRunJob/work_v1_1-8 3000 515957 ns/op
26+
BenchmarkWorkerRunJob/work_v2_1-8 5000 284516 ns/op
27+
BenchmarkWorkerRunJob/work_v1_10-8 1000 2136546 ns/op
28+
BenchmarkWorkerRunJob/work_v2_10-8 5000 367997 ns/op
29+
BenchmarkWorkerRunJob/work_v1_100-8 100 18234023 ns/op
30+
BenchmarkWorkerRunJob/work_v2_100-8 1000 1759186 ns/op
31+
BenchmarkWorkerRunJob/work_v1_1000-8 10 162110100 ns/op
32+
BenchmarkWorkerRunJob/work_v2_1000-8 100 12646080 ns/op
33+
BenchmarkWorkerRunJob/work_v1_10000-8 1 1691287122 ns/op
34+
BenchmarkWorkerRunJob/work_v2_10000-8 10 144923087 ns/op
35+
BenchmarkWorkerRunJob/work_v1_100000-8 1 17515722574 ns/op
36+
BenchmarkWorkerRunJob/work_v2_100000-8 1 1502468637 ns/op
37+
PASS
38+
ok github.com/taylorchu/work 87.901s
39+
```
40+
- [x] http server
41+
- [x] delete job
42+
- [x] create job
43+
- [x] get job status
44+
- [x] get queue metrics (kubernetes autoscaler integration with [keda metrics api scaler](https://keda.sh/docs/2.5/scalers/metrics-api/))
45+
- [ ] OpenAPI spec
4246

4347
## License
44-
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Ftaylorchu%2Fwork.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Ftaylorchu%2Fwork?ref=badge_large)
48+
49+
[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B4257%2Fgit%40github.com%3Ataylorchu%2Fwork.git.svg?type=large)](https://app.fossa.com/projects/custom%2B4257%2Fgit%40github.com%3Ataylorchu%2Fwork.git?ref=badge_large)

bench/go.mod

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
module github.com/taylorchu/work/bench
22

3-
go 1.16
3+
go 1.17
44

55
require (
6-
github.com/go-redis/redis/v8 v8.10.0
6+
github.com/go-redis/redis/v8 v8.11.4
77
github.com/gocraft/work v0.5.2-0.20180912175354-c85b71e20062
88
github.com/gomodule/redigo v1.8.5
9-
github.com/robfig/cron v1.2.0 // indirect
109
github.com/stretchr/testify v1.7.0
11-
github.com/taylorchu/work v0.1.12-0.20210619192221-d3325e033bdf
10+
github.com/taylorchu/work v0.2.4-0.20220210165902-787ae01fa4ea
11+
)
12+
13+
require (
14+
github.com/cenkalti/backoff/v4 v4.1.2 // indirect
15+
github.com/cespare/xxhash/v2 v2.1.2 // indirect
16+
github.com/davecgh/go-spew v1.1.1 // indirect
17+
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
18+
github.com/google/uuid v1.3.0 // indirect
19+
github.com/pmezard/go-difflib v1.0.0 // indirect
20+
github.com/robfig/cron v1.2.0 // indirect
21+
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
22+
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
23+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
1224
)

0 commit comments

Comments
 (0)