From 0c29c70ce38d85464145df8455c3ccca5d605b59 Mon Sep 17 00:00:00 2001 From: Richard Knop Date: Tue, 19 Mar 2024 09:50:30 +0000 Subject: [PATCH] chore: update redigo dependency --- README.md | 38 ++++++++++++-------------------------- v2/go.mod | 4 ++-- v2/go.sum | 3 +++ 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index ddb6fdf7..048a49f8 100644 --- a/README.md +++ b/README.md @@ -57,11 +57,9 @@ Machinery is an asynchronous task queue/job queue based on distributed message p * [Dependencies](#dependencies) * [Testing](#testing) -### V2 Experiment +### V2 -Please be advised that V2 is work in progress and breaking changes can and will happen until it is ready. - -You can use the current V2 in order to avoid having to import all dependencies for brokers and backends you are not using. +I recommend using V2 in order to avoid having to import all dependencies for brokers and backends you are not using. Instead of factory, you will need to inject broker and backend objects to the server constructor: @@ -82,32 +80,22 @@ server := machinery.NewServer(cnf, broker, backend, lock) ### First Steps -Add the Machinery library to your $GOPATH/src: +To install recommended v2 release: ```sh -go get github.com/RichardKnop/machinery/v1 +go get github.com/RichardKnop/machinery/v2 ``` -Or to get experimental v2 release: +If you want to use legacy v1 version, you still can: ```sh -go get github.com/RichardKnop/machinery/v2 +go get github.com/RichardKnop/machinery ``` -First, you will need to define some tasks. Look at sample tasks in `example/tasks/tasks.go` to see a few examples. +First, you will need to define some tasks. Look at sample tasks in `v2/example/tasks/tasks.go` to see a few examples. Second, you will need to launch a worker process with one of these commands (v2 is recommended since it doesn't import dependencies for all brokers / backends, only those you actually need): -```sh -go run example/amqp/main.go worker -go run example/redis/main.go worker - -go run example/amqp/main.go worker -go run example/redis/main.go worker -``` - -You can also try v2 examples. - ```sh cd v2/ go run example/amqp/main.go worker @@ -123,12 +111,10 @@ go run example/redis/main.go worker Finally, once you have a worker running and waiting for tasks to consume, send some tasks with one of these commands (v2 is recommended since it doesn't import dependencies for all brokers / backends, only those you actually need): ```sh -go run example/v2/amqp/main.go send -go run example/v2/redigo/main.go send // Redis with redigo driver -go run example/v2/go-redis/main.go send // Redis with Go Redis driver - -go run example/v1/amqp/main.go send -go run example/v1/redis/main.go send +cd v2 +go run v2/example/amqp/main.go send +go run v2/example/redigo/main.go send // Redis with redigo driver +go run v2/example/go-redis/main.go send // Redis with Go Redis driver ``` You will be able to see the tasks being processed asynchronously by the worker: @@ -137,7 +123,7 @@ You will be able to see the tasks being processed asynchronously by the worker: ### Configuration -The [config](/v1/config/config.go) package has convenience methods for loading configuration from environment variables or a YAML file. For example, load configuration from environment variables: +The [config](/v2/config/config.go) package has convenience methods for loading configuration from environment variables or a YAML file. For example, load configuration from environment variables: ```go cnf, err := config.NewFromEnvironment() diff --git a/v2/go.mod b/v2/go.mod index 172dd1d8..c8d8c384 100644 --- a/v2/go.mod +++ b/v2/go.mod @@ -8,7 +8,7 @@ require ( github.com/aws/aws-sdk-go v1.37.16 github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b github.com/go-redsync/redsync/v4 v4.8.1 - github.com/gomodule/redigo v2.0.0+incompatible + github.com/gomodule/redigo v1.9.2 github.com/google/uuid v1.2.0 github.com/kelseyhightower/envconfig v1.4.0 github.com/opentracing/opentracing-go v1.2.0 @@ -16,7 +16,7 @@ require ( github.com/rabbitmq/amqp091-go v1.9.0 github.com/redis/go-redis/v9 v9.0.5 github.com/robfig/cron/v3 v3.0.1 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.4 github.com/urfave/cli v1.22.5 go.mongodb.org/mongo-driver v1.4.6 gopkg.in/yaml.v2 v2.4.0 diff --git a/v2/go.sum b/v2/go.sum index ced24860..7a5533e9 100644 --- a/v2/go.sum +++ b/v2/go.sum @@ -150,6 +150,8 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gomodule/redigo v1.8.2/go.mod h1:P9dn9mFrCBvWhGE1wpxx6fgq7BAeLBk+UUUzlpkBYO0= +github.com/gomodule/redigo v1.9.2 h1:HrutZBLhSIU8abiSfW8pj8mPhOyMYjZT/wcA4/L9L9s= +github.com/gomodule/redigo v1.9.2/go.mod h1:KsU3hiK/Ay8U42qpaJk+kuNa3C+spxapWpM+ywhcgtw= github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0= github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -277,6 +279,7 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203 h1:QVqDTf3h2WHt08YuiTGPZLls0Wq99X9bWd0Q5ZSBesM= github.com/stvp/tempredis v0.0.0-20181119212430-b82af8480203/go.mod h1:oqN97ltKNihBbwlX8dLpwxCl3+HnXKV/R0e+sRLd9C8= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=