2
0
mirror of https://github.com/hibiken/asynq.git synced 2025-04-21 00:00:20 +08:00

Merge branch 'master' of github.com:linhbkhn95/asynq

This commit is contained in:
linhbkhn95 2023-04-24 10:53:03 +07:00
commit f915368ea5
No known key found for this signature in database
GPG Key ID: AD2A2E38A999394F
29 changed files with 146 additions and 231 deletions

View File

@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [0.24.0] - 2023-01-02
### Added ### Added
- `PreEnqueueFunc`, `PostEnqueueFunc` is added in `Scheduler` and deprecated `EnqueueErrorHandler` (PR: https://github.com/hibiken/asynq/pull/476) - `PreEnqueueFunc`, `PostEnqueueFunc` is added in `Scheduler` and deprecated `EnqueueErrorHandler` (PR: https://github.com/hibiken/asynq/pull/476)

View File

@ -47,7 +47,7 @@ Task queues are used as a mechanism to distribute work across multiple machines.
**Status**: The library is currently undergoing **heavy development** with frequent, breaking API changes. **Status**: The library is currently undergoing **heavy development** with frequent, breaking API changes.
> ☝️ **Important Note**: Current major version is zero (`v0.x.x`) to accomodate rapid development and fast iteration while getting early feedback from users (_feedback on APIs are appreciated!_). The public API could change without a major version update before `v1.0.0` release. > ☝️ **Important Note**: Current major version is zero (`v0.x.x`) to accommodate rapid development and fast iteration while getting early feedback from users (_feedback on APIs are appreciated!_). The public API could change without a major version update before `v1.0.0` release.
## Quickstart ## Quickstart

View File

@ -14,7 +14,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-redis/redis/v8" "github.com/redis/go-redis/v9"
"github.com/hibiken/asynq/internal/base" "github.com/hibiken/asynq/internal/base"
) )
@ -519,7 +519,7 @@ func parseRedisSentinelURI(u *url.URL) (RedisConnOpt, error) {
if v, ok := u.User.Password(); ok { if v, ok := u.User.Password(); ok {
password = v password = v
} }
return RedisFailoverClientOpt{MasterName: master, SentinelAddrs: addrs, Password: password}, nil return RedisFailoverClientOpt{MasterName: master, SentinelAddrs: addrs, SentinelPassword: password}, nil
} }
// ResultWriter is a client interface to write result data for a task. // ResultWriter is a client interface to write result data for a task.

View File

@ -11,7 +11,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/go-redis/redis/v8" "github.com/redis/go-redis/v9"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts" "github.com/google/go-cmp/cmp/cmpopts"
"github.com/hibiken/asynq/internal/log" "github.com/hibiken/asynq/internal/log"
@ -143,9 +143,9 @@ func TestParseRedisURI(t *testing.T) {
{ {
"redis-sentinel://:mypassword@localhost:5000,localhost:5001,localhost:5002?master=mymaster", "redis-sentinel://:mypassword@localhost:5000,localhost:5001,localhost:5002?master=mymaster",
RedisFailoverClientOpt{ RedisFailoverClientOpt{
MasterName: "mymaster", MasterName: "mymaster",
SentinelAddrs: []string{"localhost:5000", "localhost:5001", "localhost:5002"}, SentinelAddrs: []string{"localhost:5000", "localhost:5001", "localhost:5002"},
Password: "mypassword", SentinelPassword: "mypassword",
}, },
}, },
} }

View File

@ -10,7 +10,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-redis/redis/v8" "github.com/redis/go-redis/v9"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/hibiken/asynq/internal/base" "github.com/hibiken/asynq/internal/base"
"github.com/hibiken/asynq/internal/errors" "github.com/hibiken/asynq/internal/errors"

9
go.mod
View File

@ -3,16 +3,15 @@ module github.com/hibiken/asynq
go 1.14 go 1.14
require ( require (
github.com/go-redis/redis/v8 v8.11.2 github.com/golang/protobuf v1.5.2
github.com/golang/protobuf v1.4.2
github.com/google/go-cmp v0.5.6 github.com/google/go-cmp v0.5.6
github.com/google/uuid v1.2.0 github.com/google/uuid v1.2.0
github.com/redis/go-redis/v9 v9.0.3
github.com/robfig/cron/v3 v3.0.1 github.com/robfig/cron/v3 v3.0.1
github.com/spf13/cast v1.3.1 github.com/spf13/cast v1.3.1
github.com/test-go/testify v1.1.4
go.uber.org/goleak v1.1.12 go.uber.org/goleak v1.1.12
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
google.golang.org/protobuf v1.25.0 google.golang.org/protobuf v1.26.0
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
) )

120
go.sum
View File

@ -1,61 +1,31 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/bsm/ginkgo/v2 v2.7.0 h1:ItPMPH90RbmZJt5GtkcNvIRuGEdwlBItdNVoyzaNQao=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/bsm/ginkgo/v2 v2.7.0/go.mod h1:AiKlXPm7ItEHNc/2+OkrNG4E0ITzojb9/xWzvQ9XZ9w=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/bsm/gomega v1.26.0 h1:LhQm+AFcgV2M0WyKroMASzAzCAJVpAxQXv4SaI9a69Y=
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/bsm/gomega v1.26.0/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/go-redis/redis/v8 v8.11.2 h1:WqlSpAwz8mxDSMCvbyz1Mkiqe0LE5OY4j3lgkvu1Ts0=
github.com/go-redis/redis/v8 v8.11.2/go.mod h1:DLomh7y2e3ggQXQLd1YgmvIfecPJoFl7WU5SOQ/r06M=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.15.0 h1:1V1NfVQR87RtWAgp1lv9JZJ5Jap+XFGKPi00andXGi4=
github.com/onsi/ginkgo v1.15.0/go.mod h1:hF8qUzuuC8DJGygJH3726JnCZX4MYbRB8yFfISqnKUg=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.10.5 h1:7n6FEkpFmfCoo2t+YYqXH0evK+a9ICQz0xcAy9dYcaQ=
github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/redis/go-redis/v9 v9.0.3 h1:+7mmR26M0IvyLxGZUHxu4GiBkJkVDid0Un+j4ScYu4k=
github.com/redis/go-redis/v9 v9.0.3/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng= github.com/spf13/cast v1.3.1 h1:nFm6S0SMdyzrzcmThSipiEubIDy8WEXKNZ0UOgiRpng=
@ -64,69 +34,36 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE=
github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=
go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@ -134,35 +71,12 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

View File

@ -22,7 +22,7 @@ import (
// Test goes through a few phases. // Test goes through a few phases.
// //
// Phase1: Simulate Server startup; Simulate starting tasks listed in startedWorkers // Phase1: Simulate Server startup; Simulate starting tasks listed in startedWorkers
// Phase2: Simluate finishing tasks listed in finishedTasks // Phase2: Simulate finishing tasks listed in finishedTasks
// Phase3: Simulate Server shutdown; // Phase3: Simulate Server shutdown;
func TestHeartbeater(t *testing.T) { func TestHeartbeater(t *testing.T) {
r := setup(t) r := setup(t)
@ -41,7 +41,7 @@ func TestHeartbeater(t *testing.T) {
t5 := h.NewTaskMessageWithQueue("task5", nil, "custom") t5 := h.NewTaskMessageWithQueue("task5", nil, "custom")
t6 := h.NewTaskMessageWithQueue("task6", nil, "default") t6 := h.NewTaskMessageWithQueue("task6", nil, "default")
// Note: intentionally set to time less than now.Add(rdb.LeaseDuration) to test lease extention is working. // Note: intentionally set to time less than now.Add(rdb.LeaseDuration) to test lease extension is working.
lease1 := h.NewLeaseWithClock(now.Add(10*time.Second), clock) lease1 := h.NewLeaseWithClock(now.Add(10*time.Second), clock)
lease2 := h.NewLeaseWithClock(now.Add(10*time.Second), clock) lease2 := h.NewLeaseWithClock(now.Add(10*time.Second), clock)
lease3 := h.NewLeaseWithClock(now.Add(10*time.Second), clock) lease3 := h.NewLeaseWithClock(now.Add(10*time.Second), clock)

View File

@ -10,7 +10,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-redis/redis/v8" "github.com/redis/go-redis/v9"
"github.com/hibiken/asynq/internal/base" "github.com/hibiken/asynq/internal/base"
"github.com/hibiken/asynq/internal/errors" "github.com/hibiken/asynq/internal/errors"
"github.com/hibiken/asynq/internal/rdb" "github.com/hibiken/asynq/internal/rdb"

View File

@ -12,7 +12,6 @@ import (
"testing" "testing"
"time" "time"
"github.com/go-redis/redis/v8"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts" "github.com/google/go-cmp/cmp/cmpopts"
"github.com/google/uuid" "github.com/google/uuid"
@ -20,6 +19,7 @@ import (
"github.com/hibiken/asynq/internal/rdb" "github.com/hibiken/asynq/internal/rdb"
h "github.com/hibiken/asynq/internal/testutil" h "github.com/hibiken/asynq/internal/testutil"
"github.com/hibiken/asynq/internal/timeutil" "github.com/hibiken/asynq/internal/timeutil"
"github.com/redis/go-redis/v9"
) )
func TestInspectorQueues(t *testing.T) { func TestInspectorQueues(t *testing.T) {
@ -1138,7 +1138,7 @@ func TestInspectorListAggregatingTasks(t *testing.T) {
tasks []*h.TaskSeedData tasks []*h.TaskSeedData
allQueues []string allQueues []string
allGroups map[string][]string allGroups map[string][]string
groups map[string][]*redis.Z groups map[string][]redis.Z
}{ }{
tasks: []*h.TaskSeedData{ tasks: []*h.TaskSeedData{
{Msg: m1, State: base.TaskStateAggregating}, {Msg: m1, State: base.TaskStateAggregating},
@ -1152,7 +1152,7 @@ func TestInspectorListAggregatingTasks(t *testing.T) {
base.AllGroups("default"): {"group1", "group2"}, base.AllGroups("default"): {"group1", "group2"},
base.AllGroups("custom"): {"group1"}, base.AllGroups("custom"): {"group1"},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "group1"): { base.GroupKey("default", "group1"): {
{Member: m1.ID, Score: float64(now.Add(-30 * time.Second).Unix())}, {Member: m1.ID, Score: float64(now.Add(-30 * time.Second).Unix())},
{Member: m2.ID, Score: float64(now.Add(-20 * time.Second).Unix())}, {Member: m2.ID, Score: float64(now.Add(-20 * time.Second).Unix())},
@ -3445,7 +3445,7 @@ func TestInspectorGroups(t *testing.T) {
fixtures := struct { fixtures := struct {
tasks []*h.TaskSeedData tasks []*h.TaskSeedData
allGroups map[string][]string allGroups map[string][]string
groups map[string][]*redis.Z groups map[string][]redis.Z
}{ }{
tasks: []*h.TaskSeedData{ tasks: []*h.TaskSeedData{
{Msg: m1, State: base.TaskStateAggregating}, {Msg: m1, State: base.TaskStateAggregating},
@ -3458,7 +3458,7 @@ func TestInspectorGroups(t *testing.T) {
base.AllGroups("default"): {"group1", "group2"}, base.AllGroups("default"): {"group1", "group2"},
base.AllGroups("custom"): {"group1"}, base.AllGroups("custom"): {"group1"},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "group1"): { base.GroupKey("default", "group1"): {
{Member: m1.ID, Score: float64(now.Add(-10 * time.Second).Unix())}, {Member: m1.ID, Score: float64(now.Add(-10 * time.Second).Unix())},
{Member: m2.ID, Score: float64(now.Add(-20 * time.Second).Unix())}, {Member: m2.ID, Score: float64(now.Add(-20 * time.Second).Unix())},

View File

@ -14,7 +14,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-redis/redis/v8" "github.com/redis/go-redis/v9"
"github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes"
"github.com/hibiken/asynq/internal/errors" "github.com/hibiken/asynq/internal/errors"
pb "github.com/hibiken/asynq/internal/proto" pb "github.com/hibiken/asynq/internal/proto"
@ -23,7 +23,7 @@ import (
) )
// Version of asynq library and CLI. // Version of asynq library and CLI.
const Version = "0.23.0" const Version = "0.24.0"
// DefaultQueueName is the queue name used if none are specified by user. // DefaultQueueName is the queue name used if none are specified by user.
const DefaultQueueName = "default" const DefaultQueueName = "default"

View File

@ -10,7 +10,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-redis/redis/v8" "github.com/redis/go-redis/v9"
"github.com/hibiken/asynq/internal/base" "github.com/hibiken/asynq/internal/base"
"github.com/hibiken/asynq/internal/errors" "github.com/hibiken/asynq/internal/errors"
"github.com/spf13/cast" "github.com/spf13/cast"

View File

@ -12,7 +12,6 @@ import (
"testing" "testing"
"time" "time"
"github.com/go-redis/redis/v8"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts" "github.com/google/go-cmp/cmp/cmpopts"
"github.com/google/uuid" "github.com/google/uuid"
@ -20,6 +19,7 @@ import (
"github.com/hibiken/asynq/internal/errors" "github.com/hibiken/asynq/internal/errors"
h "github.com/hibiken/asynq/internal/testutil" h "github.com/hibiken/asynq/internal/testutil"
"github.com/hibiken/asynq/internal/timeutil" "github.com/hibiken/asynq/internal/timeutil"
"github.com/redis/go-redis/v9"
) )
func TestAllQueues(t *testing.T) { func TestAllQueues(t *testing.T) {
@ -73,11 +73,11 @@ func TestCurrentStats(t *testing.T) {
allGroups map[string][]string allGroups map[string][]string
pending map[string][]string pending map[string][]string
active map[string][]string active map[string][]string
scheduled map[string][]*redis.Z scheduled map[string][]redis.Z
retry map[string][]*redis.Z retry map[string][]redis.Z
archived map[string][]*redis.Z archived map[string][]redis.Z
completed map[string][]*redis.Z completed map[string][]redis.Z
groups map[string][]*redis.Z groups map[string][]redis.Z
processed map[string]int processed map[string]int
failed map[string]int failed map[string]int
processedTotal map[string]int processedTotal map[string]int
@ -111,7 +111,7 @@ func TestCurrentStats(t *testing.T) {
base.ActiveKey("critical"): {}, base.ActiveKey("critical"): {},
base.ActiveKey("low"): {}, base.ActiveKey("low"): {},
}, },
scheduled: map[string][]*redis.Z{ scheduled: map[string][]redis.Z{
base.ScheduledKey("default"): { base.ScheduledKey("default"): {
{Member: m3.ID, Score: float64(now.Add(time.Hour).Unix())}, {Member: m3.ID, Score: float64(now.Add(time.Hour).Unix())},
{Member: m4.ID, Score: float64(now.Unix())}, {Member: m4.ID, Score: float64(now.Unix())},
@ -119,22 +119,22 @@ func TestCurrentStats(t *testing.T) {
base.ScheduledKey("critical"): {}, base.ScheduledKey("critical"): {},
base.ScheduledKey("low"): {}, base.ScheduledKey("low"): {},
}, },
retry: map[string][]*redis.Z{ retry: map[string][]redis.Z{
base.RetryKey("default"): {}, base.RetryKey("default"): {},
base.RetryKey("critical"): {}, base.RetryKey("critical"): {},
base.RetryKey("low"): {}, base.RetryKey("low"): {},
}, },
archived: map[string][]*redis.Z{ archived: map[string][]redis.Z{
base.ArchivedKey("default"): {}, base.ArchivedKey("default"): {},
base.ArchivedKey("critical"): {}, base.ArchivedKey("critical"): {},
base.ArchivedKey("low"): {}, base.ArchivedKey("low"): {},
}, },
completed: map[string][]*redis.Z{ completed: map[string][]redis.Z{
base.CompletedKey("default"): {}, base.CompletedKey("default"): {},
base.CompletedKey("critical"): {}, base.CompletedKey("critical"): {},
base.CompletedKey("low"): {}, base.CompletedKey("low"): {},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "sms:user1"): { base.GroupKey("default", "sms:user1"): {
{Member: m7.ID, Score: float64(now.Add(-3 * time.Second).Unix())}, {Member: m7.ID, Score: float64(now.Add(-3 * time.Second).Unix())},
}, },
@ -205,7 +205,7 @@ func TestCurrentStats(t *testing.T) {
base.ActiveKey("critical"): {}, base.ActiveKey("critical"): {},
base.ActiveKey("low"): {}, base.ActiveKey("low"): {},
}, },
scheduled: map[string][]*redis.Z{ scheduled: map[string][]redis.Z{
base.ScheduledKey("default"): { base.ScheduledKey("default"): {
{Member: m3.ID, Score: float64(now.Add(time.Hour).Unix())}, {Member: m3.ID, Score: float64(now.Add(time.Hour).Unix())},
{Member: m4.ID, Score: float64(now.Unix())}, {Member: m4.ID, Score: float64(now.Unix())},
@ -213,17 +213,17 @@ func TestCurrentStats(t *testing.T) {
base.ScheduledKey("critical"): {}, base.ScheduledKey("critical"): {},
base.ScheduledKey("low"): {}, base.ScheduledKey("low"): {},
}, },
retry: map[string][]*redis.Z{ retry: map[string][]redis.Z{
base.RetryKey("default"): {}, base.RetryKey("default"): {},
base.RetryKey("critical"): {}, base.RetryKey("critical"): {},
base.RetryKey("low"): {}, base.RetryKey("low"): {},
}, },
archived: map[string][]*redis.Z{ archived: map[string][]redis.Z{
base.ArchivedKey("default"): {}, base.ArchivedKey("default"): {},
base.ArchivedKey("critical"): {}, base.ArchivedKey("critical"): {},
base.ArchivedKey("low"): {}, base.ArchivedKey("low"): {},
}, },
completed: map[string][]*redis.Z{ completed: map[string][]redis.Z{
base.CompletedKey("default"): {}, base.CompletedKey("default"): {},
base.CompletedKey("critical"): {}, base.CompletedKey("critical"): {},
base.CompletedKey("low"): {}, base.CompletedKey("low"): {},
@ -250,7 +250,7 @@ func TestCurrentStats(t *testing.T) {
}, },
oldestPendingMessageEnqueueTime: map[string]time.Time{ oldestPendingMessageEnqueueTime: map[string]time.Time{
"default": now.Add(-15 * time.Second), "default": now.Add(-15 * time.Second),
"critical": time.Time{}, // zero value since there's no pending task in this queue "critical": {}, // zero value since there's no pending task in this queue
"low": now.Add(-30 * time.Second), "low": now.Add(-30 * time.Second),
}, },
paused: []string{"critical", "low"}, paused: []string{"critical", "low"},
@ -392,7 +392,6 @@ func TestHistoricalStats(t *testing.T) {
} }
} }
} }
} }
func TestRedisInfo(t *testing.T) { func TestRedisInfo(t *testing.T) {
@ -436,7 +435,7 @@ func TestGroupStats(t *testing.T) {
fixtures := struct { fixtures := struct {
tasks []*h.TaskSeedData tasks []*h.TaskSeedData
allGroups map[string][]string allGroups map[string][]string
groups map[string][]*redis.Z groups map[string][]redis.Z
}{ }{
tasks: []*h.TaskSeedData{ tasks: []*h.TaskSeedData{
{Msg: m1, State: base.TaskStateAggregating}, {Msg: m1, State: base.TaskStateAggregating},
@ -449,7 +448,7 @@ func TestGroupStats(t *testing.T) {
base.AllGroups("default"): {"group1", "group2"}, base.AllGroups("default"): {"group1", "group2"},
base.AllGroups("custom"): {"group1"}, base.AllGroups("custom"): {"group1"},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "group1"): { base.GroupKey("default", "group1"): {
{Member: m1.ID, Score: float64(now.Add(-10 * time.Second).Unix())}, {Member: m1.ID, Score: float64(now.Add(-10 * time.Second).Unix())},
{Member: m2.ID, Score: float64(now.Add(-20 * time.Second).Unix())}, {Member: m2.ID, Score: float64(now.Add(-20 * time.Second).Unix())},
@ -487,7 +486,7 @@ func TestGroupStats(t *testing.T) {
}, },
} }
var sortGroupStatsOpt = cmp.Transformer( sortGroupStatsOpt := cmp.Transformer(
"SortGroupStats", "SortGroupStats",
func(in []*GroupStat) []*GroupStat { func(in []*GroupStat) []*GroupStat {
out := append([]*GroupStat(nil), in...) out := append([]*GroupStat(nil), in...)
@ -1509,7 +1508,6 @@ func TestListCompleted(t *testing.T) {
continue continue
} }
} }
} }
func TestListCompletedPagination(t *testing.T) { func TestListCompletedPagination(t *testing.T) {
@ -1585,7 +1583,7 @@ func TestListAggregating(t *testing.T) {
tasks []*h.TaskSeedData tasks []*h.TaskSeedData
allQueues []string allQueues []string
allGroups map[string][]string allGroups map[string][]string
groups map[string][]*redis.Z groups map[string][]redis.Z
}{ }{
tasks: []*h.TaskSeedData{ tasks: []*h.TaskSeedData{
{Msg: m1, State: base.TaskStateAggregating}, {Msg: m1, State: base.TaskStateAggregating},
@ -1598,7 +1596,7 @@ func TestListAggregating(t *testing.T) {
base.AllGroups("default"): {"group1", "group2"}, base.AllGroups("default"): {"group1", "group2"},
base.AllGroups("custom"): {"group3"}, base.AllGroups("custom"): {"group3"},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "group1"): { base.GroupKey("default", "group1"): {
{Member: m1.ID, Score: float64(now.Add(-30 * time.Second).Unix())}, {Member: m1.ID, Score: float64(now.Add(-30 * time.Second).Unix())},
{Member: m2.ID, Score: float64(now.Add(-20 * time.Second).Unix())}, {Member: m2.ID, Score: float64(now.Add(-20 * time.Second).Unix())},
@ -1665,14 +1663,14 @@ func TestListAggregatingPagination(t *testing.T) {
tasks []*h.TaskSeedData tasks []*h.TaskSeedData
allQueues []string allQueues []string
allGroups map[string][]string allGroups map[string][]string
groups map[string][]*redis.Z groups map[string][]redis.Z
}{ }{
tasks: []*h.TaskSeedData{}, // will be populated below tasks: []*h.TaskSeedData{}, // will be populated below
allQueues: []string{"default"}, allQueues: []string{"default"},
allGroups: map[string][]string{ allGroups: map[string][]string{
base.AllGroups("default"): {"mygroup"}, base.AllGroups("default"): {"mygroup"},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
groupkey: {}, // will be populated below groupkey: {}, // will be populated below
}, },
} }
@ -1683,7 +1681,7 @@ func TestListAggregatingPagination(t *testing.T) {
fxt.tasks = append(fxt.tasks, &h.TaskSeedData{ fxt.tasks = append(fxt.tasks, &h.TaskSeedData{
Msg: msg, State: base.TaskStateAggregating, Msg: msg, State: base.TaskStateAggregating,
}) })
fxt.groups[groupkey] = append(fxt.groups[groupkey], &redis.Z{ fxt.groups[groupkey] = append(fxt.groups[groupkey], redis.Z{
Member: msg.ID, Member: msg.ID,
Score: float64(now.Add(-time.Duration(100-i) * time.Second).Unix()), Score: float64(now.Add(-time.Duration(100-i) * time.Second).Unix()),
}) })
@ -1999,7 +1997,7 @@ func TestRunAggregatingTask(t *testing.T) {
tasks []*h.TaskSeedData tasks []*h.TaskSeedData
allQueues []string allQueues []string
allGroups map[string][]string allGroups map[string][]string
groups map[string][]*redis.Z groups map[string][]redis.Z
}{ }{
tasks: []*h.TaskSeedData{ tasks: []*h.TaskSeedData{
{Msg: m1, State: base.TaskStateAggregating}, {Msg: m1, State: base.TaskStateAggregating},
@ -2011,7 +2009,7 @@ func TestRunAggregatingTask(t *testing.T) {
base.AllGroups("default"): {"group1"}, base.AllGroups("default"): {"group1"},
base.AllGroups("custom"): {"group1"}, base.AllGroups("custom"): {"group1"},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "group1"): { base.GroupKey("default", "group1"): {
{Member: m1.ID, Score: float64(now.Add(-20 * time.Second).Unix())}, {Member: m1.ID, Score: float64(now.Add(-20 * time.Second).Unix())},
{Member: m2.ID, Score: float64(now.Add(-25 * time.Second).Unix())}, {Member: m2.ID, Score: float64(now.Add(-25 * time.Second).Unix())},
@ -2324,7 +2322,6 @@ func TestRunTaskError(t *testing.T) {
} }
} }
} }
} }
func TestRunAllScheduledTasks(t *testing.T) { func TestRunAllScheduledTasks(t *testing.T) {
@ -2691,7 +2688,7 @@ func TestRunAllAggregatingTasks(t *testing.T) {
tasks []*h.TaskSeedData tasks []*h.TaskSeedData
allQueues []string allQueues []string
allGroups map[string][]string allGroups map[string][]string
groups map[string][]*redis.Z groups map[string][]redis.Z
}{ }{
tasks: []*h.TaskSeedData{ tasks: []*h.TaskSeedData{
{Msg: m1, State: base.TaskStateAggregating}, {Msg: m1, State: base.TaskStateAggregating},
@ -2703,7 +2700,7 @@ func TestRunAllAggregatingTasks(t *testing.T) {
base.AllGroups("default"): {"group1"}, base.AllGroups("default"): {"group1"},
base.AllGroups("custom"): {"group2"}, base.AllGroups("custom"): {"group2"},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "group1"): { base.GroupKey("default", "group1"): {
{Member: m1.ID, Score: float64(now.Add(-20 * time.Second).Unix())}, {Member: m1.ID, Score: float64(now.Add(-20 * time.Second).Unix())},
{Member: m2.ID, Score: float64(now.Add(-25 * time.Second).Unix())}, {Member: m2.ID, Score: float64(now.Add(-25 * time.Second).Unix())},
@ -3001,7 +2998,7 @@ func TestArchiveAggregatingTask(t *testing.T) {
tasks []*h.TaskSeedData tasks []*h.TaskSeedData
allQueues []string allQueues []string
allGroups map[string][]string allGroups map[string][]string
groups map[string][]*redis.Z groups map[string][]redis.Z
}{ }{
tasks: []*h.TaskSeedData{ tasks: []*h.TaskSeedData{
{Msg: m1, State: base.TaskStateAggregating}, {Msg: m1, State: base.TaskStateAggregating},
@ -3013,7 +3010,7 @@ func TestArchiveAggregatingTask(t *testing.T) {
base.AllGroups("default"): {"group1"}, base.AllGroups("default"): {"group1"},
base.AllGroups("custom"): {"group1"}, base.AllGroups("custom"): {"group1"},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "group1"): { base.GroupKey("default", "group1"): {
{Member: m1.ID, Score: float64(now.Add(-20 * time.Second).Unix())}, {Member: m1.ID, Score: float64(now.Add(-20 * time.Second).Unix())},
{Member: m2.ID, Score: float64(now.Add(-25 * time.Second).Unix())}, {Member: m2.ID, Score: float64(now.Add(-25 * time.Second).Unix())},
@ -3335,6 +3332,7 @@ func TestArchiveTaskError(t *testing.T) {
} }
} }
} }
func TestArchiveAllPendingTasks(t *testing.T) { func TestArchiveAllPendingTasks(t *testing.T) {
r := setup(t) r := setup(t)
defer r.Close() defer r.Close()
@ -3485,7 +3483,7 @@ func TestArchiveAllAggregatingTasks(t *testing.T) {
tasks []*h.TaskSeedData tasks []*h.TaskSeedData
allQueues []string allQueues []string
allGroups map[string][]string allGroups map[string][]string
groups map[string][]*redis.Z groups map[string][]redis.Z
}{ }{
tasks: []*h.TaskSeedData{ tasks: []*h.TaskSeedData{
{Msg: m1, State: base.TaskStateAggregating}, {Msg: m1, State: base.TaskStateAggregating},
@ -3497,7 +3495,7 @@ func TestArchiveAllAggregatingTasks(t *testing.T) {
base.AllGroups("default"): {"group1"}, base.AllGroups("default"): {"group1"},
base.AllGroups("custom"): {"group2"}, base.AllGroups("custom"): {"group2"},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "group1"): { base.GroupKey("default", "group1"): {
{Member: m1.ID, Score: float64(now.Add(-20 * time.Second).Unix())}, {Member: m1.ID, Score: float64(now.Add(-20 * time.Second).Unix())},
{Member: m2.ID, Score: float64(now.Add(-25 * time.Second).Unix())}, {Member: m2.ID, Score: float64(now.Add(-25 * time.Second).Unix())},
@ -4124,7 +4122,7 @@ func TestDeleteAggregatingTask(t *testing.T) {
tasks []*h.TaskSeedData tasks []*h.TaskSeedData
allQueues []string allQueues []string
allGroups map[string][]string allGroups map[string][]string
groups map[string][]*redis.Z groups map[string][]redis.Z
}{ }{
tasks: []*h.TaskSeedData{ tasks: []*h.TaskSeedData{
{Msg: m1, State: base.TaskStateAggregating}, {Msg: m1, State: base.TaskStateAggregating},
@ -4136,7 +4134,7 @@ func TestDeleteAggregatingTask(t *testing.T) {
base.AllGroups("default"): {"group1"}, base.AllGroups("default"): {"group1"},
base.AllGroups("custom"): {"group1"}, base.AllGroups("custom"): {"group1"},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "group1"): { base.GroupKey("default", "group1"): {
{Member: m1.ID, Score: float64(now.Add(-20 * time.Second).Unix())}, {Member: m1.ID, Score: float64(now.Add(-20 * time.Second).Unix())},
{Member: m2.ID, Score: float64(now.Add(-25 * time.Second).Unix())}, {Member: m2.ID, Score: float64(now.Add(-25 * time.Second).Unix())},
@ -4758,7 +4756,7 @@ func TestDeleteAllAggregatingTasks(t *testing.T) {
tasks []*h.TaskSeedData tasks []*h.TaskSeedData
allQueues []string allQueues []string
allGroups map[string][]string allGroups map[string][]string
groups map[string][]*redis.Z groups map[string][]redis.Z
}{ }{
tasks: []*h.TaskSeedData{ tasks: []*h.TaskSeedData{
{Msg: m1, State: base.TaskStateAggregating}, {Msg: m1, State: base.TaskStateAggregating},
@ -4770,7 +4768,7 @@ func TestDeleteAllAggregatingTasks(t *testing.T) {
base.AllGroups("default"): {"group1"}, base.AllGroups("default"): {"group1"},
base.AllGroups("custom"): {"group1"}, base.AllGroups("custom"): {"group1"},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "group1"): { base.GroupKey("default", "group1"): {
{Member: m1.ID, Score: float64(now.Add(-20 * time.Second).Unix())}, {Member: m1.ID, Score: float64(now.Add(-20 * time.Second).Unix())},
{Member: m2.ID, Score: float64(now.Add(-25 * time.Second).Unix())}, {Member: m2.ID, Score: float64(now.Add(-25 * time.Second).Unix())},

View File

@ -11,11 +11,11 @@ import (
"math" "math"
"time" "time"
"github.com/go-redis/redis/v8"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/hibiken/asynq/internal/base" "github.com/hibiken/asynq/internal/base"
"github.com/hibiken/asynq/internal/errors" "github.com/hibiken/asynq/internal/errors"
"github.com/hibiken/asynq/internal/timeutil" "github.com/hibiken/asynq/internal/timeutil"
"github.com/redis/go-redis/v9"
"github.com/spf13/cast" "github.com/spf13/cast"
) )
@ -67,7 +67,7 @@ func (r *RDB) runScript(ctx context.Context, op errors.Op, script *redis.Script,
return nil return nil
} }
// Runs the given script with keys and args and retuns the script's return value as int64. // Runs the given script with keys and args and returns the script's return value as int64.
func (r *RDB) runScriptWithErrorCode(ctx context.Context, op errors.Op, script *redis.Script, keys []string, args ...interface{}) (int64, error) { func (r *RDB) runScriptWithErrorCode(ctx context.Context, op errors.Op, script *redis.Script, keys []string, args ...interface{}) (int64, error) {
res, err := script.Run(ctx, r.client, keys, args...).Result() res, err := script.Run(ctx, r.client, keys, args...).Result()
if err != nil { if err != nil {
@ -368,7 +368,7 @@ func (r *RDB) Done(ctx context.Context, msg *base.TaskMessage) error {
// //
// ARGV[1] -> task ID // ARGV[1] -> task ID
// ARGV[2] -> stats expiration timestamp // ARGV[2] -> stats expiration timestamp
// ARGV[3] -> task exipration time in unix time // ARGV[3] -> task expiration time in unix time
// ARGV[4] -> task message data // ARGV[4] -> task message data
// ARGV[5] -> max int64 value // ARGV[5] -> max int64 value
var markAsCompleteCmd = redis.NewScript(` var markAsCompleteCmd = redis.NewScript(`
@ -379,7 +379,7 @@ if redis.call("ZREM", KEYS[2], ARGV[1]) == 0 then
return redis.error_reply("NOT FOUND") return redis.error_reply("NOT FOUND")
end end
if redis.call("ZADD", KEYS[3], ARGV[3], ARGV[1]) ~= 1 then if redis.call("ZADD", KEYS[3], ARGV[3], ARGV[1]) ~= 1 then
redis.redis.error_reply("INTERNAL") return redis.error_reply("INTERNAL")
end end
redis.call("HSET", KEYS[4], "msg", ARGV[4], "state", "completed") redis.call("HSET", KEYS[4], "msg", ARGV[4], "state", "completed")
local n = redis.call("INCR", KEYS[5]) local n = redis.call("INCR", KEYS[5])
@ -405,7 +405,7 @@ return redis.status_reply("OK")
// //
// ARGV[1] -> task ID // ARGV[1] -> task ID
// ARGV[2] -> stats expiration timestamp // ARGV[2] -> stats expiration timestamp
// ARGV[3] -> task exipration time in unix time // ARGV[3] -> task expiration time in unix time
// ARGV[4] -> task message data // ARGV[4] -> task message data
// ARGV[5] -> max int64 value // ARGV[5] -> max int64 value
var markAsCompleteUniqueCmd = redis.NewScript(` var markAsCompleteUniqueCmd = redis.NewScript(`
@ -416,7 +416,7 @@ if redis.call("ZREM", KEYS[2], ARGV[1]) == 0 then
return redis.error_reply("NOT FOUND") return redis.error_reply("NOT FOUND")
end end
if redis.call("ZADD", KEYS[3], ARGV[3], ARGV[1]) ~= 1 then if redis.call("ZADD", KEYS[3], ARGV[3], ARGV[1]) ~= 1 then
redis.redis.error_reply("INTERNAL") return redis.error_reply("INTERNAL")
end end
redis.call("HSET", KEYS[4], "msg", ARGV[4], "state", "completed") redis.call("HSET", KEYS[4], "msg", ARGV[4], "state", "completed")
local n = redis.call("INCR", KEYS[5]) local n = redis.call("INCR", KEYS[5])
@ -1086,7 +1086,7 @@ const aggregationTimeout = 2 * time.Minute
// The time for gracePeriod and maxDelay is computed relative to the time t. // The time for gracePeriod and maxDelay is computed relative to the time t.
// //
// Note: It assumes that this function is called at frequency less than or equal to the gracePeriod. In other words, // Note: It assumes that this function is called at frequency less than or equal to the gracePeriod. In other words,
// the function only checks the most recently added task aganist the given gracePeriod. // the function only checks the most recently added task against the given gracePeriod.
func (r *RDB) AggregationCheck(qname, gname string, t time.Time, gracePeriod, maxDelay time.Duration, maxSize int) (string, error) { func (r *RDB) AggregationCheck(qname, gname string, t time.Time, gracePeriod, maxDelay time.Duration, maxSize int) (string, error) {
var op errors.Op = "RDB.AggregationCheck" var op errors.Op = "RDB.AggregationCheck"
aggregationSetID := uuid.NewString() aggregationSetID := uuid.NewString()
@ -1319,9 +1319,9 @@ func (r *RDB) ListLeaseExpired(cutoff time.Time, qnames ...string) ([]*base.Task
// It returns a new expiration time if the operation was successful. // It returns a new expiration time if the operation was successful.
func (r *RDB) ExtendLease(qname string, ids ...string) (expirationTime time.Time, err error) { func (r *RDB) ExtendLease(qname string, ids ...string) (expirationTime time.Time, err error) {
expireAt := r.clock.Now().Add(LeaseDuration) expireAt := r.clock.Now().Add(LeaseDuration)
var zs []*redis.Z var zs []redis.Z
for _, id := range ids { for _, id := range ids {
zs = append(zs, &redis.Z{Member: id, Score: float64(expireAt.Unix())}) zs = append(zs, redis.Z{Member: id, Score: float64(expireAt.Unix())})
} }
// Use XX option to only update elements that already exist; Don't add new elements // Use XX option to only update elements that already exist; Don't add new elements
// TODO: Consider adding GT option to ensure we only "extend" the lease. Ceveat is that GT is supported from redis v6.2.0 or above. // TODO: Consider adding GT option to ensure we only "extend" the lease. Ceveat is that GT is supported from redis v6.2.0 or above.
@ -1367,10 +1367,10 @@ func (r *RDB) WriteServerState(info *base.ServerInfo, workers []*base.WorkerInfo
} }
skey := base.ServerInfoKey(info.Host, info.PID, info.ServerID) skey := base.ServerInfoKey(info.Host, info.PID, info.ServerID)
wkey := base.WorkersKey(info.Host, info.PID, info.ServerID) wkey := base.WorkersKey(info.Host, info.PID, info.ServerID)
if err := r.client.ZAdd(ctx, base.AllServers, &redis.Z{Score: float64(exp.Unix()), Member: skey}).Err(); err != nil { if err := r.client.ZAdd(ctx, base.AllServers, redis.Z{Score: float64(exp.Unix()), Member: skey}).Err(); err != nil {
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "sadd", Err: err}) return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "sadd", Err: err})
} }
if err := r.client.ZAdd(ctx, base.AllWorkers, &redis.Z{Score: float64(exp.Unix()), Member: wkey}).Err(); err != nil { if err := r.client.ZAdd(ctx, base.AllWorkers, redis.Z{Score: float64(exp.Unix()), Member: wkey}).Err(); err != nil {
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "zadd", Err: err}) return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "zadd", Err: err})
} }
return r.runScript(ctx, op, writeServerStateCmd, []string{skey, wkey}, args...) return r.runScript(ctx, op, writeServerStateCmd, []string{skey, wkey}, args...)
@ -1423,7 +1423,7 @@ func (r *RDB) WriteSchedulerEntries(schedulerID string, entries []*base.Schedule
} }
exp := r.clock.Now().Add(ttl).UTC() exp := r.clock.Now().Add(ttl).UTC()
key := base.SchedulerEntriesKey(schedulerID) key := base.SchedulerEntriesKey(schedulerID)
err := r.client.ZAdd(ctx, base.AllSchedulers, &redis.Z{Score: float64(exp.Unix()), Member: key}).Err() err := r.client.ZAdd(ctx, base.AllSchedulers, redis.Z{Score: float64(exp.Unix()), Member: key}).Err()
if err != nil { if err != nil {
return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "zadd", Err: err}) return errors.E(op, errors.Unknown, &errors.RedisCommandError{Command: "zadd", Err: err})
} }

View File

@ -15,7 +15,6 @@ import (
"testing" "testing"
"time" "time"
"github.com/go-redis/redis/v8"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts" "github.com/google/go-cmp/cmp/cmpopts"
"github.com/google/uuid" "github.com/google/uuid"
@ -23,6 +22,7 @@ import (
"github.com/hibiken/asynq/internal/errors" "github.com/hibiken/asynq/internal/errors"
h "github.com/hibiken/asynq/internal/testutil" h "github.com/hibiken/asynq/internal/testutil"
"github.com/hibiken/asynq/internal/timeutil" "github.com/hibiken/asynq/internal/timeutil"
"github.com/redis/go-redis/v9"
) )
// variables used for package testing. // variables used for package testing.
@ -1272,7 +1272,6 @@ func TestAddToGroupeTaskIdConflictError(t *testing.T) {
continue continue
} }
} }
} }
func TestAddToGroupUnique(t *testing.T) { func TestAddToGroupUnique(t *testing.T) {
@ -1356,7 +1355,6 @@ func TestAddToGroupUnique(t *testing.T) {
continue continue
} }
} }
} }
func TestAddToGroupUniqueTaskIdConflictError(t *testing.T) { func TestAddToGroupUniqueTaskIdConflictError(t *testing.T) {
@ -1398,7 +1396,6 @@ func TestAddToGroupUniqueTaskIdConflictError(t *testing.T) {
continue continue
} }
} }
} }
func TestSchedule(t *testing.T) { func TestSchedule(t *testing.T) {
@ -3122,7 +3119,7 @@ func TestAggregationCheck(t *testing.T) {
desc string desc string
// initial data // initial data
tasks []*h.TaskSeedData tasks []*h.TaskSeedData
groups map[string][]*redis.Z groups map[string][]redis.Z
allGroups map[string][]string allGroups map[string][]string
// args // args
@ -3141,7 +3138,7 @@ func TestAggregationCheck(t *testing.T) {
{ {
desc: "with an empty group", desc: "with an empty group",
tasks: []*h.TaskSeedData{}, tasks: []*h.TaskSeedData{},
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "mygroup"): {}, base.GroupKey("default", "mygroup"): {},
}, },
allGroups: map[string][]string{ allGroups: map[string][]string{
@ -3168,7 +3165,7 @@ func TestAggregationCheck(t *testing.T) {
{Msg: msg4, State: base.TaskStateAggregating}, {Msg: msg4, State: base.TaskStateAggregating},
{Msg: msg5, State: base.TaskStateAggregating}, {Msg: msg5, State: base.TaskStateAggregating},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "mygroup"): { base.GroupKey("default", "mygroup"): {
{Member: msg1.ID, Score: float64(now.Add(-5 * time.Minute).Unix())}, {Member: msg1.ID, Score: float64(now.Add(-5 * time.Minute).Unix())},
{Member: msg2.ID, Score: float64(now.Add(-3 * time.Minute).Unix())}, {Member: msg2.ID, Score: float64(now.Add(-3 * time.Minute).Unix())},
@ -3201,7 +3198,7 @@ func TestAggregationCheck(t *testing.T) {
{Msg: msg4, State: base.TaskStateAggregating}, {Msg: msg4, State: base.TaskStateAggregating},
{Msg: msg5, State: base.TaskStateAggregating}, {Msg: msg5, State: base.TaskStateAggregating},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "mygroup"): { base.GroupKey("default", "mygroup"): {
{Member: msg1.ID, Score: float64(now.Add(-5 * time.Minute).Unix())}, {Member: msg1.ID, Score: float64(now.Add(-5 * time.Minute).Unix())},
{Member: msg2.ID, Score: float64(now.Add(-3 * time.Minute).Unix())}, {Member: msg2.ID, Score: float64(now.Add(-3 * time.Minute).Unix())},
@ -3235,7 +3232,7 @@ func TestAggregationCheck(t *testing.T) {
{Msg: msg2, State: base.TaskStateAggregating}, {Msg: msg2, State: base.TaskStateAggregating},
{Msg: msg3, State: base.TaskStateAggregating}, {Msg: msg3, State: base.TaskStateAggregating},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "mygroup"): { base.GroupKey("default", "mygroup"): {
{Member: msg1.ID, Score: float64(now.Add(-5 * time.Minute).Unix())}, {Member: msg1.ID, Score: float64(now.Add(-5 * time.Minute).Unix())},
{Member: msg2.ID, Score: float64(now.Add(-3 * time.Minute).Unix())}, {Member: msg2.ID, Score: float64(now.Add(-3 * time.Minute).Unix())},
@ -3266,7 +3263,7 @@ func TestAggregationCheck(t *testing.T) {
{Msg: msg4, State: base.TaskStateAggregating}, {Msg: msg4, State: base.TaskStateAggregating},
{Msg: msg5, State: base.TaskStateAggregating}, {Msg: msg5, State: base.TaskStateAggregating},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "mygroup"): { base.GroupKey("default", "mygroup"): {
{Member: msg1.ID, Score: float64(now.Add(-15 * time.Minute).Unix())}, {Member: msg1.ID, Score: float64(now.Add(-15 * time.Minute).Unix())},
{Member: msg2.ID, Score: float64(now.Add(-3 * time.Minute).Unix())}, {Member: msg2.ID, Score: float64(now.Add(-3 * time.Minute).Unix())},
@ -3299,7 +3296,7 @@ func TestAggregationCheck(t *testing.T) {
{Msg: msg4, State: base.TaskStateAggregating}, {Msg: msg4, State: base.TaskStateAggregating},
{Msg: msg5, State: base.TaskStateAggregating}, {Msg: msg5, State: base.TaskStateAggregating},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "mygroup"): { base.GroupKey("default", "mygroup"): {
{Member: msg1.ID, Score: float64(now.Add(-15 * time.Minute).Unix())}, {Member: msg1.ID, Score: float64(now.Add(-15 * time.Minute).Unix())},
{Member: msg2.ID, Score: float64(now.Add(-3 * time.Minute).Unix())}, {Member: msg2.ID, Score: float64(now.Add(-3 * time.Minute).Unix())},
@ -3338,7 +3335,7 @@ func TestAggregationCheck(t *testing.T) {
{Msg: msg4, State: base.TaskStateAggregating}, {Msg: msg4, State: base.TaskStateAggregating},
{Msg: msg5, State: base.TaskStateAggregating}, {Msg: msg5, State: base.TaskStateAggregating},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "mygroup"): { base.GroupKey("default", "mygroup"): {
{Member: msg1.ID, Score: float64(now.Add(-15 * time.Minute).Unix())}, {Member: msg1.ID, Score: float64(now.Add(-15 * time.Minute).Unix())},
{Member: msg2.ID, Score: float64(now.Add(-3 * time.Minute).Unix())}, {Member: msg2.ID, Score: float64(now.Add(-3 * time.Minute).Unix())},
@ -3371,7 +3368,7 @@ func TestAggregationCheck(t *testing.T) {
{Msg: msg4, State: base.TaskStateAggregating}, {Msg: msg4, State: base.TaskStateAggregating},
{Msg: msg5, State: base.TaskStateAggregating}, {Msg: msg5, State: base.TaskStateAggregating},
}, },
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "mygroup"): { base.GroupKey("default", "mygroup"): {
{Member: msg1.ID, Score: float64(now.Add(-15 * time.Minute).Unix())}, {Member: msg1.ID, Score: float64(now.Add(-15 * time.Minute).Unix())},
{Member: msg2.ID, Score: float64(now.Add(-3 * time.Minute).Unix())}, {Member: msg2.ID, Score: float64(now.Add(-3 * time.Minute).Unix())},
@ -3473,8 +3470,8 @@ func TestDeleteAggregationSet(t *testing.T) {
desc string desc string
// initial data // initial data
tasks []*h.TaskSeedData tasks []*h.TaskSeedData
aggregationSets map[string][]*redis.Z aggregationSets map[string][]redis.Z
allAggregationSets map[string][]*redis.Z allAggregationSets map[string][]redis.Z
// args // args
ctx context.Context ctx context.Context
@ -3494,14 +3491,14 @@ func TestDeleteAggregationSet(t *testing.T) {
{Msg: m2, State: base.TaskStateAggregating}, {Msg: m2, State: base.TaskStateAggregating},
{Msg: m3, State: base.TaskStateAggregating}, {Msg: m3, State: base.TaskStateAggregating},
}, },
aggregationSets: map[string][]*redis.Z{ aggregationSets: map[string][]redis.Z{
base.AggregationSetKey("default", "mygroup", setID): { base.AggregationSetKey("default", "mygroup", setID): {
{Member: m1.ID, Score: float64(now.Add(-5 * time.Minute).Unix())}, {Member: m1.ID, Score: float64(now.Add(-5 * time.Minute).Unix())},
{Member: m2.ID, Score: float64(now.Add(-4 * time.Minute).Unix())}, {Member: m2.ID, Score: float64(now.Add(-4 * time.Minute).Unix())},
{Member: m3.ID, Score: float64(now.Add(-3 * time.Minute).Unix())}, {Member: m3.ID, Score: float64(now.Add(-3 * time.Minute).Unix())},
}, },
}, },
allAggregationSets: map[string][]*redis.Z{ allAggregationSets: map[string][]redis.Z{
base.AllAggregationSets("default"): { base.AllAggregationSets("default"): {
{Member: base.AggregationSetKey("default", "mygroup", setID), Score: float64(now.Add(aggregationTimeout).Unix())}, {Member: base.AggregationSetKey("default", "mygroup", setID), Score: float64(now.Add(aggregationTimeout).Unix())},
}, },
@ -3528,7 +3525,7 @@ func TestDeleteAggregationSet(t *testing.T) {
{Msg: m2, State: base.TaskStateAggregating}, {Msg: m2, State: base.TaskStateAggregating},
{Msg: m3, State: base.TaskStateAggregating}, {Msg: m3, State: base.TaskStateAggregating},
}, },
aggregationSets: map[string][]*redis.Z{ aggregationSets: map[string][]redis.Z{
base.AggregationSetKey("default", "mygroup", setID): { base.AggregationSetKey("default", "mygroup", setID): {
{Member: m1.ID, Score: float64(now.Add(-5 * time.Minute).Unix())}, {Member: m1.ID, Score: float64(now.Add(-5 * time.Minute).Unix())},
}, },
@ -3537,7 +3534,7 @@ func TestDeleteAggregationSet(t *testing.T) {
{Member: m3.ID, Score: float64(now.Add(-3 * time.Minute).Unix())}, {Member: m3.ID, Score: float64(now.Add(-3 * time.Minute).Unix())},
}, },
}, },
allAggregationSets: map[string][]*redis.Z{ allAggregationSets: map[string][]redis.Z{
base.AllAggregationSets("default"): { base.AllAggregationSets("default"): {
{Member: base.AggregationSetKey("default", "mygroup", setID), Score: float64(now.Add(aggregationTimeout).Unix())}, {Member: base.AggregationSetKey("default", "mygroup", setID), Score: float64(now.Add(aggregationTimeout).Unix())},
{Member: base.AggregationSetKey("default", "mygroup", otherSetID), Score: float64(now.Add(aggregationTimeout).Unix())}, {Member: base.AggregationSetKey("default", "mygroup", otherSetID), Score: float64(now.Add(aggregationTimeout).Unix())},
@ -3602,8 +3599,8 @@ func TestDeleteAggregationSetError(t *testing.T) {
desc string desc string
// initial data // initial data
tasks []*h.TaskSeedData tasks []*h.TaskSeedData
aggregationSets map[string][]*redis.Z aggregationSets map[string][]redis.Z
allAggregationSets map[string][]*redis.Z allAggregationSets map[string][]redis.Z
// args // args
ctx context.Context ctx context.Context
@ -3622,14 +3619,14 @@ func TestDeleteAggregationSetError(t *testing.T) {
{Msg: m2, State: base.TaskStateAggregating}, {Msg: m2, State: base.TaskStateAggregating},
{Msg: m3, State: base.TaskStateAggregating}, {Msg: m3, State: base.TaskStateAggregating},
}, },
aggregationSets: map[string][]*redis.Z{ aggregationSets: map[string][]redis.Z{
base.AggregationSetKey("default", "mygroup", setID): { base.AggregationSetKey("default", "mygroup", setID): {
{Member: m1.ID, Score: float64(now.Add(-5 * time.Minute).Unix())}, {Member: m1.ID, Score: float64(now.Add(-5 * time.Minute).Unix())},
{Member: m2.ID, Score: float64(now.Add(-4 * time.Minute).Unix())}, {Member: m2.ID, Score: float64(now.Add(-4 * time.Minute).Unix())},
{Member: m3.ID, Score: float64(now.Add(-3 * time.Minute).Unix())}, {Member: m3.ID, Score: float64(now.Add(-3 * time.Minute).Unix())},
}, },
}, },
allAggregationSets: map[string][]*redis.Z{ allAggregationSets: map[string][]redis.Z{
base.AllAggregationSets("default"): { base.AllAggregationSets("default"): {
{Member: base.AggregationSetKey("default", "mygroup", setID), Score: float64(now.Add(aggregationTimeout).Unix())}, {Member: base.AggregationSetKey("default", "mygroup", setID), Score: float64(now.Add(aggregationTimeout).Unix())},
}, },
@ -3688,23 +3685,23 @@ func TestReclaimStaleAggregationSets(t *testing.T) {
// Note: In this test, we're trying out a new way to test RDB by exactly describing how // Note: In this test, we're trying out a new way to test RDB by exactly describing how
// keys and values are represented in Redis. // keys and values are represented in Redis.
tests := []struct { tests := []struct {
groups map[string][]*redis.Z // map redis-key to redis-zset groups map[string][]redis.Z // map redis-key to redis-zset
aggregationSets map[string][]*redis.Z aggregationSets map[string][]redis.Z
allAggregationSets map[string][]*redis.Z allAggregationSets map[string][]redis.Z
qname string qname string
wantGroups map[string][]redis.Z wantGroups map[string][]redis.Z
wantAggregationSets map[string][]redis.Z wantAggregationSets map[string][]redis.Z
wantAllAggregationSets map[string][]redis.Z wantAllAggregationSets map[string][]redis.Z
}{ }{
{ {
groups: map[string][]*redis.Z{ groups: map[string][]redis.Z{
base.GroupKey("default", "foo"): {}, base.GroupKey("default", "foo"): {},
base.GroupKey("default", "bar"): {}, base.GroupKey("default", "bar"): {},
base.GroupKey("default", "qux"): { base.GroupKey("default", "qux"): {
{Member: m4.ID, Score: float64(now.Add(-10 * time.Second).Unix())}, {Member: m4.ID, Score: float64(now.Add(-10 * time.Second).Unix())},
}, },
}, },
aggregationSets: map[string][]*redis.Z{ aggregationSets: map[string][]redis.Z{
base.AggregationSetKey("default", "foo", "set1"): { base.AggregationSetKey("default", "foo", "set1"): {
{Member: m1.ID, Score: float64(now.Add(-3 * time.Minute).Unix())}, {Member: m1.ID, Score: float64(now.Add(-3 * time.Minute).Unix())},
{Member: m2.ID, Score: float64(now.Add(-4 * time.Minute).Unix())}, {Member: m2.ID, Score: float64(now.Add(-4 * time.Minute).Unix())},
@ -3713,7 +3710,7 @@ func TestReclaimStaleAggregationSets(t *testing.T) {
{Member: m3.ID, Score: float64(now.Add(-1 * time.Minute).Unix())}, {Member: m3.ID, Score: float64(now.Add(-1 * time.Minute).Unix())},
}, },
}, },
allAggregationSets: map[string][]*redis.Z{ allAggregationSets: map[string][]redis.Z{
base.AllAggregationSets("default"): { base.AllAggregationSets("default"): {
{Member: base.AggregationSetKey("default", "foo", "set1"), Score: float64(now.Add(-10 * time.Second).Unix())}, // set1 is expired {Member: base.AggregationSetKey("default", "foo", "set1"), Score: float64(now.Add(-10 * time.Second).Unix())}, // set1 is expired
{Member: base.AggregationSetKey("default", "bar", "set2"), Score: float64(now.Add(40 * time.Second).Unix())}, // set2 is not expired {Member: base.AggregationSetKey("default", "bar", "set2"), Score: float64(now.Add(40 * time.Second).Unix())}, // set2 is not expired

View File

@ -11,7 +11,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-redis/redis/v8" "github.com/redis/go-redis/v9"
"github.com/hibiken/asynq/internal/base" "github.com/hibiken/asynq/internal/base"
) )

View File

@ -13,12 +13,12 @@ import (
"testing" "testing"
"time" "time"
"github.com/go-redis/redis/v8"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts" "github.com/google/go-cmp/cmp/cmpopts"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/hibiken/asynq/internal/base" "github.com/hibiken/asynq/internal/base"
"github.com/hibiken/asynq/internal/timeutil" "github.com/hibiken/asynq/internal/timeutil"
"github.com/redis/go-redis/v9"
) )
// EquateInt64Approx returns a Comparer option that treats int64 values // EquateInt64Approx returns a Comparer option that treats int64 values
@ -252,7 +252,7 @@ func SeedLease(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname s
seedRedisZSet(tb, r, base.LeaseKey(qname), entries, base.TaskStateActive) seedRedisZSet(tb, r, base.LeaseKey(qname), entries, base.TaskStateActive)
} }
// SeedCompletedQueue initializes the completed set witht the given entries. // SeedCompletedQueue initializes the completed set with the given entries.
func SeedCompletedQueue(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname string) { func SeedCompletedQueue(tb testing.TB, r redis.UniversalClient, entries []base.Z, qname string) {
tb.Helper() tb.Helper()
r.SAdd(context.Background(), base.AllQueues, qname) r.SAdd(context.Background(), base.AllQueues, qname)
@ -377,7 +377,7 @@ func seedRedisZSet(tb testing.TB, c redis.UniversalClient, key string,
for _, item := range items { for _, item := range items {
msg := item.Message msg := item.Message
encoded := MustMarshal(tb, msg) encoded := MustMarshal(tb, msg)
z := &redis.Z{Member: msg.ID, Score: float64(item.Score)} z := redis.Z{Member: msg.ID, Score: float64(item.Score)}
if err := c.ZAdd(context.Background(), key, z).Err(); err != nil { if err := c.ZAdd(context.Background(), key, z).Err(); err != nil {
tb.Fatal(err) tb.Fatal(err)
} }
@ -570,7 +570,7 @@ func SeedTasks(tb testing.TB, r redis.UniversalClient, taskData []*TaskSeedData)
} }
} }
func SeedRedisZSets(tb testing.TB, r redis.UniversalClient, zsets map[string][]*redis.Z) { func SeedRedisZSets(tb testing.TB, r redis.UniversalClient, zsets map[string][]redis.Z) {
for key, zs := range zsets { for key, zs := range zsets {
// FIXME: How come we can't simply do ZAdd(ctx, key, zs...) here? // FIXME: How come we can't simply do ZAdd(ctx, key, zs...) here?
for _, z := range zs { for _, z := range zs {

View File

@ -22,7 +22,6 @@ import (
"github.com/hibiken/asynq/internal/rdb" "github.com/hibiken/asynq/internal/rdb"
h "github.com/hibiken/asynq/internal/testutil" h "github.com/hibiken/asynq/internal/testutil"
"github.com/hibiken/asynq/internal/timeutil" "github.com/hibiken/asynq/internal/timeutil"
"github.com/test-go/testify/assert"
) )
var taskCmpOpts = []cmp.Option{ var taskCmpOpts = []cmp.Option{
@ -955,10 +954,12 @@ func TestReturnPanicError(t *testing.T) {
logger: log.NewLogger(nil), logger: log.NewLogger(nil),
handler: tc.handler, handler: tc.handler,
} }
err := p.perform(context.Background(), task) got := p.perform(context.Background(), task)
assert.Equal(t, tc.IsPanicError, IsPanicError(err)) if tc.IsPanicError != IsPanicError(got) {
if tc.IsPanicError { t.Errorf("%s: got=%t, want=%t", tc.name, IsPanicError(got), tc.IsPanicError)
assert.Equal(t, true, strings.HasPrefix(err.Error(), "panic error cause by:")) }
if tc.IsPanicError && !strings.HasPrefix(got.Error(), "panic error cause by:") {
t.Error("wrong text msg for panic error")
} }
}) })
} }

View File

@ -87,7 +87,7 @@ func (r *recoverer) recover() {
} }
func (r *recoverer) recoverLeaseExpiredTasks() { func (r *recoverer) recoverLeaseExpiredTasks() {
// Get all tasks which have expired 30 seconds ago or earlier to accomodate certain amount of clock skew. // Get all tasks which have expired 30 seconds ago or earlier to accommodate certain amount of clock skew.
cutoff := time.Now().Add(-30 * time.Second) cutoff := time.Now().Add(-30 * time.Second)
msgs, err := r.broker.ListLeaseExpired(cutoff, r.queues...) msgs, err := r.broker.ListLeaseExpired(cutoff, r.queues...)
if err != nil { if err != nil {

View File

@ -10,7 +10,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-redis/redis/v8" "github.com/redis/go-redis/v9"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/hibiken/asynq/internal/base" "github.com/hibiken/asynq/internal/base"
"github.com/hibiken/asynq/internal/log" "github.com/hibiken/asynq/internal/log"
@ -274,6 +274,7 @@ func (s *Scheduler) runHeartbeater() {
case <-s.done: case <-s.done:
s.logger.Debugf("Scheduler heatbeater shutting down") s.logger.Debugf("Scheduler heatbeater shutting down")
s.rdb.ClearSchedulerEntries(s.id) s.rdb.ClearSchedulerEntries(s.id)
ticker.Stop()
return return
case <-ticker.C: case <-ticker.C:
s.beat() s.beat()

View File

@ -15,7 +15,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-redis/redis/v8" "github.com/redis/go-redis/v9"
"github.com/hibiken/asynq/internal/base" "github.com/hibiken/asynq/internal/base"
"github.com/hibiken/asynq/internal/log" "github.com/hibiken/asynq/internal/log"
"github.com/hibiken/asynq/internal/rdb" "github.com/hibiken/asynq/internal/rdb"

View File

@ -19,7 +19,7 @@ import (
func TestServer(t *testing.T) { func TestServer(t *testing.T) {
// https://github.com/go-redis/redis/issues/1029 // https://github.com/go-redis/redis/issues/1029
ignoreOpt := goleak.IgnoreTopFunction("github.com/go-redis/redis/v8/internal/pool.(*ConnPool).reaper") ignoreOpt := goleak.IgnoreTopFunction("github.com/redis/go-redis/v9/internal/pool.(*ConnPool).reaper")
defer goleak.VerifyNone(t, ignoreOpt) defer goleak.VerifyNone(t, ignoreOpt)
redisConnOpt := getRedisConnOpt(t) redisConnOpt := getRedisConnOpt(t)
@ -55,7 +55,7 @@ func TestServer(t *testing.T) {
func TestServerRun(t *testing.T) { func TestServerRun(t *testing.T) {
// https://github.com/go-redis/redis/issues/1029 // https://github.com/go-redis/redis/issues/1029
ignoreOpt := goleak.IgnoreTopFunction("github.com/go-redis/redis/v8/internal/pool.(*ConnPool).reaper") ignoreOpt := goleak.IgnoreTopFunction("github.com/redis/go-redis/v9/internal/pool.(*ConnPool).reaper")
defer goleak.VerifyNone(t, ignoreOpt) defer goleak.VerifyNone(t, ignoreOpt)
srv := NewServer(RedisClientOpt{Addr: ":6379"}, Config{LogLevel: testLogLevel}) srv := NewServer(RedisClientOpt{Addr: ":6379"}, Config{LogLevel: testLogLevel})

View File

@ -8,7 +8,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-redis/redis/v8" "github.com/redis/go-redis/v9"
"github.com/hibiken/asynq/internal/base" "github.com/hibiken/asynq/internal/base"
"github.com/hibiken/asynq/internal/log" "github.com/hibiken/asynq/internal/log"
) )

View File

@ -39,6 +39,7 @@ var dashCmd = &cobra.Command{
} }
dash.Run(dash.Options{ dash.Run(dash.Options{
PollInterval: flagPollInterval, PollInterval: flagPollInterval,
RedisConnOpt: getRedisConnOpt(),
}) })
}, },
} }

View File

@ -91,6 +91,7 @@ func (s *State) DebugString() string {
type Options struct { type Options struct {
DebugMode bool DebugMode bool
PollInterval time.Duration PollInterval time.Duration
RedisConnOpt asynq.RedisConnOpt
} }
func Run(opts Options) { func Run(opts Options) {
@ -108,7 +109,7 @@ func Run(opts Options) {
var ( var (
state = State{} // confined in this goroutine only; DO NOT SHARE state = State{} // confined in this goroutine only; DO NOT SHARE
inspector = asynq.NewInspector(asynq.RedisClientOpt{Addr: ":6379"}) inspector = asynq.NewInspector(opts.RedisConnOpt)
ticker = time.NewTicker(opts.PollInterval) ticker = time.NewTicker(opts.PollInterval)
eventCh = make(chan tcell.Event) eventCh = make(chan tcell.Event)

View File

@ -446,7 +446,7 @@ func nextTaskState(current asynq.TaskState) asynq.TaskState {
} }
} }
} }
panic("unkown task state") panic("unknown task state")
} }
func prevTaskState(current asynq.TaskState) asynq.TaskState { func prevTaskState(current asynq.TaskState) asynq.TaskState {
@ -459,7 +459,7 @@ func prevTaskState(current asynq.TaskState) asynq.TaskState {
} }
} }
} }
panic("unkown task state") panic("unknown task state")
} }
func getTaskCount(queue *asynq.QueueInfo, taskState asynq.TaskState) int { func getTaskCount(queue *asynq.QueueInfo, taskState asynq.TaskState) int {

View File

@ -351,7 +351,7 @@ func initConfig() {
// createRDB creates a RDB instance using flag values and returns it. // createRDB creates a RDB instance using flag values and returns it.
func createRDB() *rdb.RDB { func createRDB() *rdb.RDB {
var c redis.UniversalClient var c redis.UniversalClient
if useRedisCluster { if viper.GetBool("cluster") {
addrs := strings.Split(viper.GetString("cluster_addrs"), ",") addrs := strings.Split(viper.GetString("cluster_addrs"), ",")
c = redis.NewClusterClient(&redis.ClusterOptions{ c = redis.NewClusterClient(&redis.ClusterOptions{
Addrs: addrs, Addrs: addrs,
@ -375,7 +375,7 @@ func createInspector() *asynq.Inspector {
} }
func getRedisConnOpt() asynq.RedisConnOpt { func getRedisConnOpt() asynq.RedisConnOpt {
if useRedisCluster { if viper.GetBool("cluster") {
addrs := strings.Split(viper.GetString("cluster_addrs"), ",") addrs := strings.Split(viper.GetString("cluster_addrs"), ",")
return asynq.RedisClusterClientOpt{ return asynq.RedisClusterClientOpt{
Addrs: addrs, Addrs: addrs,

View File

@ -21,7 +21,7 @@ require (
require ( require (
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/gdamore/encoding v1.0.0 // indirect github.com/gdamore/encoding v1.0.0 // indirect

View File

@ -34,8 +34,9 @@ github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJm
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=