diff --git a/.deepsource.toml b/.deepsource.toml index 7095050d6..94d8c46da 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -9,4 +9,4 @@ name = "go" enabled = true [analyzers.meta] - import_paths = ["github.com/RichardKnop/machinery"] \ No newline at end of file + import_paths = ["github.com/Michael-LiK/machinery"] \ No newline at end of file diff --git a/Dockerfile.test b/Dockerfile.test index 967e5f7c1..9f751c345 100644 --- a/Dockerfile.test +++ b/Dockerfile.test @@ -9,13 +9,13 @@ MAINTAINER Richard Knop ENV PATH /go/bin:$PATH # Cd into the source code directory -WORKDIR /go/src/github.com/RichardKnop/machinery +WORKDIR /go/src/github.com/Michael-LiK/machinery # Copy the local package files to the container's workspace. -ADD . /go/src/github.com/RichardKnop/machinery +ADD . /go/src/github.com/Michael-LiK/machinery # Set GO111MODULE=on variable to activate module support ENV GO111MODULE on # Run integration tests as default command -CMD /go/src/github.com/RichardKnop/machinery/wait-for-it.sh rabbitmq:5672 -- make test-with-coverage +CMD /go/src/github.com/Michael-LiK/machinery/wait-for-it.sh rabbitmq:5672 -- make test-with-coverage diff --git a/README.md b/README.md index e430ce025..202dac07b 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,24 @@ -[1]: https://raw.githubusercontent.com/RichardKnop/assets/master/machinery/example_worker.png -[2]: https://raw.githubusercontent.com/RichardKnop/assets/master/machinery/example_worker_receives_tasks.png +[1]: https://raw.githubusercontent.com/Michael-LiK/assets/master/machinery/example_worker.png +[2]: https://raw.githubusercontent.com/Michael-LiK/assets/master/machinery/example_worker_receives_tasks.png [3]: http://patreon_public_assets.s3.amazonaws.com/sized/becomeAPatronBanner.png ## Machinery Machinery is an asynchronous task queue/job queue based on distributed message passing. -[![Travis Status for RichardKnop/machinery](https://travis-ci.org/RichardKnop/machinery.svg?branch=master&label=linux+build)](https://travis-ci.org/RichardKnop/machinery) -[![godoc for RichardKnop/machinery](https://godoc.org/github.com/nathany/looper?status.svg)](http://godoc.org/github.com/RichardKnop/machinery/v1) -[![codecov for RichardKnop/machinery](https://codecov.io/gh/RichardKnop/machinery/branch/master/graph/badge.svg)](https://codecov.io/gh/RichardKnop/machinery) +[![Travis Status for Michael-LiK/machinery](https://travis-ci.org/Michael-LiK/machinery.svg?branch=master&label=linux+build)](https://travis-ci.org/Michael-LiK/machinery) +[![godoc for Michael-LiK/machinery](https://godoc.org/github.com/nathany/looper?status.svg)](http://godoc.org/github.com/Michael-LiK/machinery/v1) +[![codecov for Michael-LiK/machinery](https://codecov.io/gh/Michael-LiK/machinery/branch/master/graph/badge.svg)](https://codecov.io/gh/Michael-LiK/machinery) -[![Go Report Card](https://goreportcard.com/badge/github.com/RichardKnop/machinery)](https://goreportcard.com/report/github.com/RichardKnop/machinery) -[![GolangCI](https://golangci.com/badges/github.com/RichardKnop/machinery.svg)](https://golangci.com) +[![Go Report Card](https://goreportcard.com/badge/github.com/Michael-LiK/machinery)](https://goreportcard.com/report/github.com/Michael-LiK/machinery) +[![GolangCI](https://golangci.com/badges/github.com/Michael-LiK/machinery.svg)](https://golangci.com) [![OpenTracing Badge](https://img.shields.io/badge/OpenTracing-enabled-blue.svg)](http://opentracing.io) -[![Sourcegraph for RichardKnop/machinery](https://sourcegraph.com/github.com/RichardKnop/machinery/-/badge.svg)](https://sourcegraph.com/github.com/RichardKnop/machinery?badge) -[![Donate Bitcoin](https://img.shields.io/badge/donate-bitcoin-orange.svg)](https://richardknop.github.io/donate/) +[![Sourcegraph for Michael-LiK/machinery](https://sourcegraph.com/github.com/Michael-LiK/machinery/-/badge.svg)](https://sourcegraph.com/github.com/Michael-LiK/machinery?badge) +[![Donate Bitcoin](https://img.shields.io/badge/donate-bitcoin-orange.svg)](https://Michael-LiK.github.io/donate/) --- +* [中文文档](./README_CN.md) * [V2 Experiment](#v2-experiment) * [First Steps](#first-steps) @@ -67,10 +68,10 @@ Instead of factory, you will need to inject broker and backend objects to the se ```go import ( - "github.com/RichardKnop/machinery/v2" - backendsiface "github.com/RichardKnop/machinery/v2/backends/iface" - brokersiface "github.com/RichardKnop/machinery/v2/brokers/iface" - locksiface "github.com/RichardKnop/machinery/v2/locks/iface" + "github.com/Michael-LiK/machinery/v2" + backendsiface "github.com/Michael-LiK/machinery/v2/backends/iface" + brokersiface "github.com/Michael-LiK/machinery/v2/brokers/iface" + locksiface "github.com/Michael-LiK/machinery/v2/locks/iface" ) var broker brokersiface.Broker @@ -85,13 +86,13 @@ server := machinery.NewServer(cnf, broker, backend, lock) Add the Machinery library to your $GOPATH/src: ```sh -go get github.com/RichardKnop/machinery/v1 +go get github.com/Michael-LiK/machinery/v1 ``` Or to get experimental v2 release: ```sh -go get github.com/RichardKnop/machinery/v2 +go get github.com/Michael-LiK/machinery/v2 ``` First, you will need to define some tasks. Look at sample tasks in `example/tasks/tasks.go` to see a few examples. @@ -313,7 +314,7 @@ For example: 1. `amqp://guest:guest@localhost:5672` -> Keep in mind AMQP is not recommended as a result backend. See [Keeping Results](https://github.com/RichardKnop/machinery#keeping-results) +> Keep in mind AMQP is not recommended as a result backend. See [Keeping Results](https://github.com/Michael-LiK/machinery#keeping-results) ##### MongoDB @@ -392,7 +393,7 @@ type Interface interface { } ``` -Then just set the logger in your setup code by calling `Set` function exported by `github.com/RichardKnop/machinery/v1/log` package: +Then just set the logger in your setup code by calling `Set` function exported by `github.com/Michael-LiK/machinery/v1/log` package: ```go log.Set(myCustomLogger) @@ -404,8 +405,8 @@ A Machinery library must be instantiated before use. The way this is done is by ```go import ( - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1" ) var cnf = &config.Config{ @@ -632,7 +633,7 @@ Tasks can be called by passing an instance of `Signature` to an `Server` instanc ```go import ( - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/tasks" ) signature := &tasks.Signature{ @@ -797,8 +798,8 @@ Running a single asynchronous task is fine but often you will want to design a w ```go import ( - "github.com/RichardKnop/machinery/v1/tasks" - "github.com/RichardKnop/machinery/v1" + "github.com/Michael-LiK/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" ) signature1 := tasks.Signature{ @@ -858,8 +859,8 @@ for _, asyncResult := range asyncResults { ```go import ( - "github.com/RichardKnop/machinery/v1/tasks" - "github.com/RichardKnop/machinery/v1" + "github.com/Michael-LiK/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" ) signature1 := tasks.Signature{ @@ -934,8 +935,8 @@ for _, result := range results { ```go import ( - "github.com/RichardKnop/machinery/v1/tasks" - "github.com/RichardKnop/machinery/v1" + "github.com/Michael-LiK/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" ) signature1 := tasks.Signature{ @@ -1020,7 +1021,7 @@ Machinery now supports scheduling periodic tasks and workflows. See examples bel ```go import ( - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/tasks" ) signature := &tasks.Signature{ @@ -1046,8 +1047,8 @@ if err != nil { ```go import ( - "github.com/RichardKnop/machinery/v1/tasks" - "github.com/RichardKnop/machinery/v1" + "github.com/Michael-LiK/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" ) signature1 := tasks.Signature{ @@ -1089,8 +1090,8 @@ if err != nil { ```go import ( - "github.com/RichardKnop/machinery/v1/tasks" - "github.com/RichardKnop/machinery/v1" + "github.com/Michael-LiK/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" ) signature1 := tasks.Signature{ @@ -1142,8 +1143,8 @@ if err != nil { ```go import ( - "github.com/RichardKnop/machinery/v1/tasks" - "github.com/RichardKnop/machinery/v1" + "github.com/Michael-LiK/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" ) signature1 := tasks.Signature{ diff --git a/README_CN.md b/README_CN.md new file mode 100644 index 000000000..4d14cc602 --- /dev/null +++ b/README_CN.md @@ -0,0 +1,1266 @@ +[1]: https://raw.githubusercontent.com/Michael-LiK/assets/master/machinery/example_worker.png +[2]: https://raw.githubusercontent.com/Michael-LiK/assets/master/machinery/example_worker_receives_tasks.png +[3]: http://patreon_public_assets.s3.amazonaws.com/sized/becomeAPatronBanner.png + +## Machinery + +Machinery 是一个基于分布式消息传递的异步任务队列框架. + +[![Travis Status for Michael-LiK/machinery](https://travis-ci.org/Michael-LiK/machinery.svg?branch=master&label=linux+build)](https://travis-ci.org/Michael-LiK/machinery) +[![godoc for Michael-LiK/machinery](https://godoc.org/github.com/nathany/looper?status.svg)](http://godoc.org/github.com/Michael-LiK/machinery/v1) +[![codecov for Michael-LiK/machinery](https://codecov.io/gh/Michael-LiK/machinery/branch/master/graph/badge.svg)](https://codecov.io/gh/Michael-LiK/machinery) + +[![Go Report Card](https://goreportcard.com/badge/github.com/Michael-LiK/machinery)](https://goreportcard.com/report/github.com/Michael-LiK/machinery) +[![GolangCI](https://golangci.com/badges/github.com/Michael-LiK/machinery.svg)](https://golangci.com) +[![OpenTracing Badge](https://img.shields.io/badge/OpenTracing-enabled-blue.svg)](http://opentracing.io) + +[![Sourcegraph for Michael-LiK/machinery](https://sourcegraph.com/github.com/Michael-LiK/machinery/-/badge.svg)](https://sourcegraph.com/github.com/Michael-LiK/machinery?badge) +[![Donate Bitcoin](https://img.shields.io/badge/donate-bitcoin-orange.svg)](https://Michael-LiK.github.io/donate/) + +--- + +* [V2 Experiment](#v2-experiment) +* [First Steps](#快速开始) +* [Configuration](#configuration) + * [Lock](#lock) + * [Broker](#broker) + * [DefaultQueue](#defaultqueue) + * [ResultBackend](#resultbackend) + * [ResultsExpireIn](#resultsexpirein) + * [AMQP](#amqp-2) + * [DynamoDB](#dynamodb) + * [Redis](#redis-2) + * [GCPPubSub](#gcppubsub) +* [Custom Logger](#custom-logger) +* [Server](#server) +* [Workers](#workers) +* [Tasks](#tasks) + * [Registering Tasks](#registering-tasks) + * [Signatures](#signatures) + * [Supported Types](#supported-types) + * [Sending Tasks](#sending-tasks) + * [Delayed Tasks](#delayed-tasks) + * [Retry Tasks](#retry-tasks) + * [Get Pending Tasks](#get-pending-tasks) + * [Keeping Results](#keeping-results) +* [Workflows](#workflows) + * [Groups](#groups) + * [Chords](#chords) + * [Chains](#chains) +* [Periodic Tasks & Workflows](#periodic-tasks--workflows) + * [Periodic Tasks](#periodic-tasks) + * [Periodic Groups](#periodic-groups) + * [Periodic Chains](#periodic-chains) + * [Periodic Chords](#periodic-chords) +* [Development](#development) + * [Requirements](#requirements) + * [Dependencies](#dependencies) + * [Testing](#testing) + +### V2 实验版本 + +需要注意的是v2版本目前正在研发中,所以在正式版发布前,v2可能会有较大的改变。 + +你可以使用v2版本来避免导入那些你没有使用的所有依赖。 + +Instead of factory, you will need to inject broker and backend objects to the server constructor: + +```go +import ( + "github.com/Michael-LiK/machinery/v2" + backendsiface "github.com/Michael-LiK/machinery/v2/backends/iface" + brokersiface "github.com/Michael-LiK/machinery/v2/brokers/iface" + locksiface "github.com/Michael-LiK/machinery/v2/locks/iface" +) + +var broker brokersiface.Broker +var backend backendsiface.Backend +var lock locksiface.Lock +server := machinery.NewServer(cnf, broker, backend, lock) +// server.NewWorker("machinery", 10) +``` + +### 快速开始 + +将Machinery依赖添加到你的 $GOPATH/src: + +```sh +go get github.com/Michael-LiK/machinery/v1 +``` + +或者使用实验版本 v2 release: + +```sh +go get github.com/Michael-LiK/machinery/v2 +``` + +首先你需要定义一些任务. 可以浏览示例 `example/tasks/tasks.go` 这里有一些简单的例子. + +然后, 你讲通过一下的一些命令去发布一个工作进程 (v2 建议不要导入所有的 brokers / backends, 只导入你真正需要的即可): + +```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 +``` + +你也可以使用v2中的例子. + +```sh +cd v2/ +go run example/amqp/main.go worker +go run example/redigo/main.go worker // Redis with redigo driver +go run example/go-redis/main.go worker // Redis with Go Redis driver + +go run example/amqp/main.go worker +go run example/redis/main.go worker +``` + +![Example worker][1] + +最后, 只要你一个进程在运行,通过下面这些命令发送任务,并且等在任务去消费即可。 (建议使用v2 ,因为它不会导入所有代理/后端的依赖项,而只导入您实际需要的依赖项): + +```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 +``` + +你将可以看到任务正在被进程异步的处理了: + +![Example worker receives tasks][2] + +### 配置 + + [config](/v1/config/config.go) 配置有多种方便的加载方式,可以从环境变量或者YAML文件中去加载配置: + +```go +cnf, err := config.NewFromEnvironment() +``` + +Or load from YAML file: + +```go +cnf, err := config.NewFromYaml("config.yml", true) +``` + +第二个布尔值参数代表是否进行实时的配置重载,如果为true,系统将每个10秒进行一次配置重载,如果为false则不进行实时配置重载。 + +Machinery 配置通过一个名为 `Config` 的结构体进行封装,并作为依赖项注入到需要它的对象中。 + +#### Lock + +##### Redis + +使用redis链接需要按照如下几种格式: + +``` +redis://[password@]host[port][/db_num] +``` + +例如: + +1. `redis://localhost:6379`, 或者使用密码 `redis://password@localhost:6379` + +#### Broker + +消息 broker,现在支持多种 brokers 他们分别是: + +##### AMQP + +使用AMQP链接需要按照如下几种格式: + +``` +amqp://[username:password@]@host[:port] +``` + +例如: + +1. `amqp://guest:guest@localhost:5672` + +AMQP 也支持多个 brokers 链接.你需要具体填写 URL separator 在`MultipleBrokerSeparator` 字段. + +##### Redis + +使用redis链接需要按照如下几种格式: + +``` +redis://[password@]host[port][/db_num] +redis+socket://[password@]/path/to/file.sock[:/db_num] +``` + +例如: + +1. `redis://localhost:6379`, 或者使用密码 `redis://password@localhost:6379` +2. `redis+socket://password@/path/to/file.sock:/0` + +##### AWS SQS + +使用 AWS SQS 链接需要按照如下格式: + +``` +https://sqs.us-east-2.amazonaws.com/123456789012 +``` + +查看 [AWS SQS 文档](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html) 可以了解更多信息。 +此外还需要配置`AWS_REGION`,否则一个error将被抛出。 + +手动配置 SQS Client: + +```go +var sqsClient = sqs.New(session.Must(session.NewSession(&aws.Config{ + Region: aws.String("YOUR_AWS_REGION"), + Credentials: credentials.NewStaticCredentials("YOUR_AWS_ACCESS_KEY", "YOUR_AWS_ACCESS_SECRET", ""), + HTTPClient: &http.Client{ + Timeout: time.Second * 120, + }, +}))) +var visibilityTimeout = 20 +var cnf = &config.Config{ + Broker: "YOUR_SQS_URL" + DefaultQueue: "machinery_tasks", + ResultBackend: "YOUR_BACKEND_URL", + SQS: &config.SQSConfig{ + Client: sqsClient, + // if VisibilityTimeout is nil default to the overall visibility timeout setting for the queue + // https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html + VisibilityTimeout: &visibilityTimeout, + WaitTimeSeconds: 30, + }, +} +``` + +##### GCP Pub/Sub + +使用 GCP Pub/Sub URL 在如下格式: + +``` +gcppubsub://YOUR_GCP_PROJECT_ID/YOUR_PUBSUB_SUBSCRIPTION_NAME +``` + +手动配置 Pub/Sub Client: + +```go +pubsubClient, err := pubsub.NewClient( + context.Background(), + "YOUR_GCP_PROJECT_ID", + option.WithServiceAccountFile("YOUR_GCP_SERVICE_ACCOUNT_FILE"), +) + +cnf := &config.Config{ + Broker: "gcppubsub://YOUR_GCP_PROJECT_ID/YOUR_PUBSUB_SUBSCRIPTION_NAME" + DefaultQueue: "YOUR_PUBSUB_TOPIC_NAME", + ResultBackend: "YOUR_BACKEND_URL", + GCPPubSub: config.GCPPubSubConfig{ + Client: pubsubClient, + }, +} +``` + +#### 默认队列(DefaultQueue) + +默认队列名称, 例如: `machinery_tasks`. + +#### 结果存放(ResultBackend) + +Result backend 被用来保存任务的状态和结果. + +现在支持的结果存放有如下这些: + +##### Redis + +使用Redis URL 在如下格式: + +``` +redis://[password@]host[port][/db_num] +redis+socket://[password@]/path/to/file.sock[:/db_num] +``` + +例如: + +1. `redis://localhost:6379`, 或者使用密码 `redis://password@localhost:6379` +2. `redis+socket://password@/path/to/file.sock:/0` +3. cluster `redis://host1:port1,host2:port2,host3:port3` +4. cluster with password `redis://pass@host1:port1,host2:port2,host3:port3` + +##### Memcache + +使用 Memcache URL 在如下格式: + +``` +memcache://host1[:port1][,host2[:port2],...[,hostN[:portN]]] +``` + +例如: + +1. `memcache://localhost:11211`一个简单实例,或者: +2. `memcache://10.0.0.1:11211,10.0.0.2:11211` 一个集群 + +##### AMQP + +使用 AMQP URL 采用以下格式: + +``` +amqp://[username:password@]@host[:port] +``` + +例如: + +1. `amqp://guest:guest@localhost:5672` + +> 请注意 AMQP 不被推荐作为结果存储使用. 详情见 [Keeping Results](https://github.com/Michael-LiK/machinery#keeping-results) + +##### MongoDB + +使用 Mongodb URL 采用以下格式: + +``` +mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]] +``` + +例如: + +1. `mongodb://localhost:27017/taskresults` + +查看 [MongoDB docs](https://docs.mongodb.org/manual/reference/connection-string/) 获得更新信息. + + +#### 结果有效期 + +任务结果的存储过期时间默认是 `3600`秒 (1 小时). + +#### AMQP + +RabbitMQ 相关配置. 如果你使用其他 broker/backend 这部分没有参考必要. + +* `Exchange`: exchange 名称, 例如: `machinery_exchange` +* `ExchangeType`: exchange 类型, 例如: `direct` +* `QueueBindingArguments`: 绑定到AMQP队列时使用的附加参数的可选映射 +* `BindingKey`: 使用此密钥将队列绑定到exchange,例如: `machinery_task` +* `PrefetchCount`: 要预取的任务数 (如果有长时间运行的任务,则设置为“1”) + +#### DynamoDB + +DynamoDB 相关设置. 如果你是用其他 backend 这部分没有参考必要. +* `TaskStatesTable`: 自定义存储任务状态的表名称。默认使用 `task_states`, 并确保首先在AWS管理员中创建此表, 使用 `TaskUUID` 作为表的主键. +* `GroupMetasTable`: 自定义存储组meta信息的表名称。默认使用 `group_metas`, 并确保首先在AWS管理员中创建此表, 使用 `GroupUUID` 作为表的主键. + +* 例如: + +``` +dynamodb: + task_states_table: 'task_states' + group_metas_table: 'group_metas' +``` +如果找不到这些表,将抛出致命错误。 + +如果你希望记录会过期, 你可以在AWS admin中给这些表配置`TTL`字段. 这个 `TTL` 字段是基于服务配置中的 `ResultsExpireIn` 值. 查看 https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/howitworks-ttl.html获取更多信息。 + +#### Redis + +Redis 相关配置. 如果你是用其他 backend 这部分没有参考必要。 + +See: [config](/v1/config/config.go) (TODO) + +#### GCPPubSub + +GCPPubSub 相关配置. 如果你是用其他 backend 这部分没有参考必要. + +See: [config](/v1/config/config.go) (TODO) + +### Custom Logger + +你可以定义一个用户级别日期通过实现一下的接口: + +```go +type Interface interface { + Print(...interface{}) + Printf(string, ...interface{}) + Println(...interface{}) + + Fatal(...interface{}) + Fatalf(string, ...interface{}) + Fatalln(...interface{}) + + Panic(...interface{}) + Panicf(string, ...interface{}) + Panicln(...interface{}) +} +``` + +然后就可以设置日志在你的安装代码中使用`Set` 方式,通过`github.com/Michael-LiK/machinery/v1/log` 这个包: + +```go +log.Set(myCustomLogger) +``` + +### Server + +一个 Machinery library在被使用之前必须被实例化.通过以下方式创建一个 `Server` 实例. `Server` 是一个存储项目配置和任务注册的基础对象。例如: + +```go +import ( + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1" +) + +var cnf = &config.Config{ + Broker: "amqp://guest:guest@localhost:5672/", + DefaultQueue: "machinery_tasks", + ResultBackend: "amqp://guest:guest@localhost:5672/", + AMQP: &config.AMQPConfig{ + Exchange: "machinery_exchange", + ExchangeType: "direct", + BindingKey: "machinery_task", + }, +} + +server, err := machinery.NewServer(cnf) +if err != nil { + // do something with the error +} +``` + +### Workers + +为了去消费任务, 你需要有一个或者多个 Workers运行. 你想运行worker仅需一个具有已注册任务的“服务器”实例。例如: + +```go +worker := server.NewWorker("worker_name", 10) +err := worker.Launch() +if err != nil { + // do something with the error +} +``` + +每个 worker 都将只消费已注册的任务. 对于队列上的每个任务 Worker.Process() 方法都将运行在一个goroutine中. 使用 `server.NewWorker`方法的第二个参数去限制并发运行的Worker.Process()的调用数量 +(单个 worker). 例如: 设置1将使任务串行执行,而0使并发执行的任务数不受限制(默认)。 + +### Tasks + +任务是Machinery应用的组成部分. 一个任务是一个函数, 一个被用户接收到消息来触发的函数。 + +每一个任务都需要返回一个error作为最后一个返回值, In addition to error tasks can now return any number of arguments. + +有效任务的示例: + +```go +func Add(args ...int64) (int64, error) { + sum := int64(0) + for _, arg := range args { + sum += arg + } + return sum, nil +} + +func Multiply(args ...int64) (int64, error) { + sum := int64(1) + for _, arg := range args { + sum *= arg + } + return sum, nil +} + +// You can use context.Context as first argument to tasks, useful for open tracing +func TaskWithContext(ctx context.Context, arg Arg) error { + // ... use ctx ... + return nil +} + +// Tasks need to return at least error as a minimal requirement +func DummyTask(arg string) error { + return errors.New(arg) +} + +// You can also return multiple results from the task +func DummyTask2(arg1, arg2 string) (string, string, error) { + return arg1, arg2, nil +} +``` + +#### 注册任务 + +在你的workers消费任务前, 你需要在server中注册它. 下面是为任务分配唯一的名称: + +```go +server.RegisterTasks(map[string]interface{}{ + "add": Add, + "multiply": Multiply, +}) +``` + +任务也可以被一个一个注册: + +```go +server.RegisterTask("add", Add) +server.RegisterTask("multiply", Multiply) +``` + +简单的推送, 当一个工作进程接收到如下消息: + +```json +{ + "UUID": "48760a1a-8576-4536-973b-da09048c2ac5", + "Name": "add", + "RoutingKey": "", + "ETA": null, + "GroupUUID": "", + "GroupTaskCount": 0, + "Args": [ + { + "Type": "int64", + "Value": 1, + }, + { + "Type": "int64", + "Value": 1, + } + ], + "Immutable": false, + "RetryCount": 0, + "RetryTimeout": 0, + "OnSuccess": null, + "OnError": null, + "ChordCallback": null +} +``` + + +它将调用 Add(1, 1)。每个任务也应该返回一个错误,以便我们可以处理失败。 + +理想情况下,任务应该是幂等的,这意味着当使用相同参数多次调用任务时不会出现意外后果。 + +#### Signatures + +签名包装了任务的调用参数、执行选项(例如不变性)和成功/错误回调,以便它可以通过线路发送给工作人员。任务签名实现了一个简单的接口: + +```go +// Arg represents a single argument passed to invocation fo a task +type Arg struct { + Type string + Value interface{} +} + +// Headers represents the headers which should be used to direct the task +type Headers map[string]interface{} + +// Signature represents a single task invocation +type Signature struct { + UUID string + Name string + RoutingKey string + ETA *time.Time + GroupUUID string + GroupTaskCount int + Args []Arg + Headers Headers + Immutable bool + RetryCount int + RetryTimeout int + OnSuccess []*Signature + OnError []*Signature + ChordCallback *Signature +} +``` + +`UUID` 一个任务的唯一ID。您可以自己设置,也可以自动生成。 + +`Name` 任务的唯一名称,是针对服务器实例注册的唯一任务名称。 + +`RoutingKey` 用于将任务路由到正确的队列。如果将其保留为空,默认行为将是将其设置为直接exchange类型的默认队列绑定键,以及其他exchange类型的默认队列名称。 + + +`ETA` 是一个用于设置任务延迟的时间戳字段。如果他为空,则这个任务将会被立即推送到woker中进行消费。 如果它被设置,这个任务将会被延迟到 ETA 时间戳. + +`GroupUUID`, `GroupTaskCount` 被用于创建给任务组。 + +`Args` 是由worker执行任务时将传递给该任务的参数列表。 + +`Headers` 将任务发布到AMQP队列时将使用的headers列表。 + +`Immutable` 是一个标志,用于定义是否可以修改已执行任务的结果。 这对于 `OnSuccess` 回调很重要。不可变任务不会将其结果传递给它的成功回调,而可变任务会将其结果添加到发送给回调任务的参数中。长话短说,如果要将链中第一个任务的结果传递给第二个任务,请将 Immutable 设置为 false。 + +`RetryCount` 指定应重试失败任务的次数(默认为 0)。重试尝试将按时间间隔,在每次失败后,下一次重试时间将更往后。 + +`RetryTimeout` 指定在将任务重新发送到队列以进行重试之前等待多长时间。默认行为是使用斐波那契数列来增加每次失败的重试尝试后的超时时间。 + +`OnSuccess`定义任务成功执行后将调用的任务。它是任务声明结构的一部分。 + +`OnError` 定义任务执行失败后将调用的任务。传递给错误回调的第一个参数将是从失败的任务返回的错误字符串。 + +`ChordCallback` 用于创建对一组任务的回调。 + +#### Supported Types + +Machinery 在发送任务到broker前将任务编码为json.任务结果也将以JSON字符串格式被存储在backend中。因此,只能支持具有原生 JSON 表示的类型。目前支持的类型是 + +* `bool` +* `int` +* `int8` +* `int16` +* `int32` +* `int64` +* `uint` +* `uint8` +* `uint16` +* `uint32` +* `uint64` +* `float32` +* `float64` +* `string` +* `[]bool` +* `[]int` +* `[]int8` +* `[]int16` +* `[]int32` +* `[]int64` +* `[]uint` +* `[]uint8` +* `[]uint16` +* `[]uint32` +* `[]uint64` +* `[]float32` +* `[]float64` +* `[]string` + +#### 发送任务 + +任务能够通过`Signature`的一个实例被调用到另一个`Server`实例。例如: + +```go +import ( + "github.com/Michael-LiK/machinery/v1/tasks" +) + +signature := &tasks.Signature{ + Name: "add", + Args: []tasks.Arg{ + { + Type: "int64", + Value: 1, + }, + { + Type: "int64", + Value: 1, + }, + }, +} + +asyncResult, err := server.SendTask(signature) +if err != nil { + // failed to send the task + // do something with the error +} +``` + +#### Delayed Tasks + +你可以延期一个任务通过在任务的声明中设置 `ETA` 时间戳字段。 + +```go +// Delay the task by 5 seconds +eta := time.Now().UTC().Add(time.Second * 5) +signature.ETA = &eta +``` + +#### Retry Tasks + +你可以设置一个重试次数在任务被声明为失败前. 斐波那契序列将用于在一段时间内分隔重试请求。(详情见 `RetryTimeout`) + +```go +// If the task fails, retry it up to 3 times +signature.RetryCount = 3 +``` + +或者, 你可以从任务重返回 `tasks.ErrRetryTaskLater`并指定应重试任务的持续时间,例如: + +```go +return tasks.NewErrRetryTaskLater("some error", 4 * time.Hour) +``` + +#### Get Pending Tasks + +可以检查当前在队列中等待workers消费的任务,例如: + +```go +server.GetBroker().GetPendingTasks("some_queue") +``` + +>目前仅支持 Redis broker . + +#### Keeping Results + +如果您配置结果backend,任务状态和结果将被持久化。可能的状态: + +```go +const ( + // StatePending - initial state of a task + StatePending = "PENDING" + // StateReceived - when task is received by a worker + StateReceived = "RECEIVED" + // StateStarted - when the worker starts processing the task + StateStarted = "STARTED" + // StateRetry - when failed task has been scheduled for retry + StateRetry = "RETRY" + // StateSuccess - when the task is processed successfully + StateSuccess = "SUCCESS" + // StateFailure - when processing of the task fails + StateFailure = "FAILURE" +) +``` + +> 当使用 AMQP 作为结果backend时,任务状态将保存在每个任务的单独队列中。尽管 RabbitMQ 可以扩展到数千个队列,但强烈建议在您期望运行大量并行任务时使用更合适的结果后端(例如 Memcache)。 +```go +// TaskResult represents an actual return value of a processed task +type TaskResult struct { + Type string `bson:"type"` + Value interface{} `bson:"value"` +} + +// TaskState represents a state of a task +type TaskState struct { + TaskUUID string `bson:"_id"` + State string `bson:"state"` + Results []*TaskResult `bson:"results"` + Error string `bson:"error"` +} + +// GroupMeta stores useful metadata about tasks within the same group +// E.g. UUIDs of all tasks which are used in order to check if all tasks +// completed successfully or not and thus whether to trigger chord callback +type GroupMeta struct { + GroupUUID string `bson:"_id"` + TaskUUIDs []string `bson:"task_uuids"` + ChordTriggered bool `bson:"chord_triggered"` + Lock bool `bson:"lock"` +} +``` + +`TaskResult` 表示已处理任务的返回值切片。 + +`TaskState` 每次任务状态发生变化时,TaskState struct 都会被序列化并存储。 + +`GroupMeta` 存储有关同一组内任务的有用元数据。例如。所有任务的 UUID 用于检查所有任务是否成功完成,从而是否触发和弦回调。 + +`AsyncResult` AsyncResult对象允许您检查任务的状态: + +```go +taskState := asyncResult.GetState() +fmt.Printf("Current state of %v task is:\n", taskState.TaskUUID) +fmt.Println(taskState.State) +``` + +有几种方便的方法可以检查任务状态: + +```go +asyncResult.GetState().IsCompleted() +asyncResult.GetState().IsSuccess() +asyncResult.GetState().IsFailure() +``` + +你也可以做一个同步阻塞调用来等待一个任务结果: + +```go +results, err := asyncResult.Get(time.Duration(time.Millisecond * 5)) +if err != nil { + // getting result of a task failed + // do something with the error +} +for _, result := range results { + fmt.Println(result.Interface()) +} +``` + +#### Error Handling + +当任务返回错误时,如果它是可重试的,默认行为是首先尝试重试任务,否则记录错误,然后最终调用任何错误回调。 + +要对此进行自定义,您可以在工作线程上设置自定义错误处理程序,该处理程序不仅可以在重试失败和错误回调触发后进行记录,还可以执行更多操作: + +```go +worker.SetErrorHandler(func (err error) { + customHandler(err) +}) +``` + +### 工作流 + +运行一个简单的异步认识是很容易,但是通常你希望能够设计一个任务编排的工作流,这里有几种有用的方式去帮助你设计工作流。 + +#### Groups + +`Group` 是一组相互独立并行执行的任务。例如。: + +```go +import ( + "github.com/Michael-LiK/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" +) + +signature1 := tasks.Signature{ + Name: "add", + Args: []tasks.Arg{ + { + Type: "int64", + Value: 1, + }, + { + Type: "int64", + Value: 1, + }, + }, +} + +signature2 := tasks.Signature{ + Name: "add", + Args: []tasks.Arg{ + { + Type: "int64", + Value: 5, + }, + { + Type: "int64", + Value: 5, + }, + }, +} + +group, _ := tasks.NewGroup(&signature1, &signature2) +asyncResults, err := server.SendGroup(group, 0) //The second parameter specifies the number of concurrent sending tasks. 0 means unlimited. +if err != nil { + // failed to send the group + // do something with the error +} +``` + +`SendGroup` 返回一个 `AsyncResult` 的对象。因此,您可以执行阻塞调用并等待组任务的结果: + +```go +for _, asyncResult := range asyncResults { + results, err := asyncResult.Get(time.Duration(time.Millisecond * 5)) + if err != nil { + // getting result of a task failed + // do something with the error + } + for _, result := range results { + fmt.Println(result.Interface()) + } +} +``` + +#### Chords + +`Chord` 允许您定义在组中的所有任务完成处理后执行的回调,例如: + +```go +import ( + "github.com/Michael-LiK/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" +) + +signature1 := tasks.Signature{ + Name: "add", + Args: []tasks.Arg{ + { + Type: "int64", + Value: 1, + }, + { + Type: "int64", + Value: 1, + }, + }, +} + +signature2 := tasks.Signature{ + Name: "add", + Args: []tasks.Arg{ + { + Type: "int64", + Value: 5, + }, + { + Type: "int64", + Value: 5, + }, + }, +} + +signature3 := tasks.Signature{ + Name: "multiply", +} + +group := tasks.NewGroup(&signature1, &signature2) +chord, _ := tasks.NewChord(group, &signature3) +chordAsyncResult, err := server.SendChord(chord, 0) //The second parameter specifies the number of concurrent sending tasks. 0 means unlimited. +if err != nil { + // failed to send the chord + // do something with the error +} +``` + +上面的示例并行执行 task1 和 task2,聚合它们的结果并将它们传递给 task3。因此,最终会展示的是: + +``` +multiply(add(1, 1), add(5, 5)) +``` + +更明确的样子: + +``` +(1 + 1) * (5 + 5) = 2 * 10 = 20 +``` + +`SendChord` 返回遵循 AsyncResult 接口的 `ChordAsyncResult`。所以你可以做一个阻塞调用并等待回调的结果: + +```go +results, err := chordAsyncResult.Get(time.Duration(time.Millisecond * 5)) +if err != nil { + // getting result of a chord failed + // do something with the error +} +for _, result := range results { + fmt.Println(result.Interface()) +} +``` + +#### Chains + +`Chain` 只是一组将逐个执行的任务,每个成功的任务都会触发链中的下一个任务。例如: + +```go +import ( + "github.com/Michael-LiK/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" +) + +signature1 := tasks.Signature{ + Name: "add", + Args: []tasks.Arg{ + { + Type: "int64", + Value: 1, + }, + { + Type: "int64", + Value: 1, + }, + }, +} + +signature2 := tasks.Signature{ + Name: "add", + Args: []tasks.Arg{ + { + Type: "int64", + Value: 5, + }, + { + Type: "int64", + Value: 5, + }, + }, +} + +signature3 := tasks.Signature{ + Name: "multiply", + Args: []tasks.Arg{ + { + Type: "int64", + Value: 4, + }, + }, +} + +chain, _ := tasks.NewChain(&signature1, &signature2, &signature3) +chainAsyncResult, err := server.SendChain(chain) +if err != nil { + // failed to send the chain + // do something with the error +} +``` + +上面的例子执行task1,然后是task2,然后是task3。当任务成功完成时,结果将附加到链中下一个任务的参数列表的末尾。因此,最终会展现的是: + +``` +multiply(4, add(5, 5, add(1, 1))) +``` + +More explicitly: + +``` + 4 * (5 + 5 + (1 + 1)) # task1: add(1, 1) returns 2 += 4 * (5 + 5 + 2) # task2: add(5, 5, 2) returns 12 += 4 * (12) # task3: multiply(4, 12) returns 48 += 48 +``` + +`SendChain` 返回遵循 AsyncResult 接口的 `ChainAsyncResult`。所以你可以做一个阻塞调用并等待整个链的结果: + +```go +results, err := chainAsyncResult.Get(time.Duration(time.Millisecond * 5)) +if err != nil { + // getting result of a chain failed + // do something with the error +} +for _, result := range results { + fmt.Println(result.Interface()) +} +``` + +### Periodic Tasks & Workflows + +Machinery 现在支持安排定期任务和工作流。请参见下面的示例。 + +#### Periodic Tasks + +```go +import ( + "github.com/Michael-LiK/machinery/v1/tasks" +) + +signature := &tasks.Signature{ + Name: "add", + Args: []tasks.Arg{ + { + Type: "int64", + Value: 1, + }, + { + Type: "int64", + Value: 1, + }, + }, +} +err := server.RegisterPeriodicTask("0 6 * * ?", "periodic-task", signature) +if err != nil { + // failed to register periodic task +} +``` + +#### Periodic Groups + +```go +import ( + "github.com/Michael-LiK/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" +) + +signature1 := tasks.Signature{ + Name: "add", + Args: []tasks.Arg{ + { + Type: "int64", + Value: 1, + }, + { + Type: "int64", + Value: 1, + }, + }, +} + +signature2 := tasks.Signature{ + Name: "add", + Args: []tasks.Arg{ + { + Type: "int64", + Value: 5, + }, + { + Type: "int64", + Value: 5, + }, + }, +} + +group, _ := tasks.NewGroup(&signature1, &signature2) +err := server.RegisterPeriodicGroup("0 6 * * ?", "periodic-group", group) +if err != nil { + // failed to register periodic group +} +``` + +#### Periodic Chains + +```go +import ( + "github.com/Michael-LiK/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" +) + +signature1 := tasks.Signature{ + Name: "add", + Args: []tasks.Arg{ + { + Type: "int64", + Value: 1, + }, + { + Type: "int64", + Value: 1, + }, + }, +} + +signature2 := tasks.Signature{ + Name: "add", + Args: []tasks.Arg{ + { + Type: "int64", + Value: 5, + }, + { + Type: "int64", + Value: 5, + }, + }, +} + +signature3 := tasks.Signature{ + Name: "multiply", + Args: []tasks.Arg{ + { + Type: "int64", + Value: 4, + }, + }, +} + +chain, _ := tasks.NewChain(&signature1, &signature2, &signature3) +err := server.RegisterPeriodicChain("0 6 * * ?", "periodic-chain", chain) +if err != nil { + // failed to register periodic chain +} +``` + +#### Chord + +```go +import ( + "github.com/Michael-LiK/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" +) + +signature1 := tasks.Signature{ + Name: "add", + Args: []tasks.Arg{ + { + Type: "int64", + Value: 1, + }, + { + Type: "int64", + Value: 1, + }, + }, +} + +signature2 := tasks.Signature{ + Name: "add", + Args: []tasks.Arg{ + { + Type: "int64", + Value: 5, + }, + { + Type: "int64", + Value: 5, + }, + }, +} + +signature3 := tasks.Signature{ + Name: "multiply", +} + +group := tasks.NewGroup(&signature1, &signature2) +chord, _ := tasks.NewChord(group, &signature3) +err := server.RegisterPeriodicChord("0 6 * * ?", "periodic-chord", chord) +if err != nil { + // failed to register periodic chord +} +``` + +### 开发相关 + +#### 环境要求 + +* Go +* RabbitMQ (可选项) +* Redis +* Memcached (可选项) +* MongoDB (可选项) + +On OS X systems, 你可以使用homebrew安装环境 [Homebrew](http://brew.sh/): + +```sh +brew install go +brew install rabbitmq +brew install redis +brew install memcached +brew install mongodb +``` + +或者可选地使用相应的 [Docker](http://docker.io/) 容器: + +``` +docker run -d -p 5672:5672 rabbitmq +docker run -d -p 6379:6379 redis +docker run -d -p 11211:11211 memcached +docker run -d -p 27017:27017 mongo +docker run -d -p 6831:6831/udp -p 16686:16686 jaegertracing/all-in-one:latest +``` + +#### 依赖 + +从 Go 1.11起, 一种新的依赖管理系统被通过(go module) [modules](https://github.com/golang/go/wiki/Modules). + +这是 Go 的一个小问题,不过限制依赖管理已经被解决。以前 Go 官方推荐使用 [dep 工具](https://github.com/golang/dep),但现在已经放弃,转而支持模块。 + +#### 测试 + +运行测试的最简单(和平台无关)方法是通过 `docker-compose`: + +```sh +make ci +``` + +运行 docker-compose 命令: + +```sh +(docker-compose -f docker-compose.test.yml -p machinery_ci up --build -d) && (docker logs -f machinery_sut &) && (docker wait machinery_sut) +``` + +另一种方法是在您的机器上设置开发环境。 + +为了启用集成测试,您需要安装所有必需的服务(RabbitMQ、Redis、Memcache、MongoDB)并导出这些环境变量: + +```sh +export AMQP_URL=amqp://guest:guest@localhost:5672/ +export REDIS_URL=localhost:6379 +export MEMCACHE_URL=localhost:11211 +export MONGODB_URL=localhost:27017 +``` + +要针对 SQS 实例运行集成测试,您需要在 SQS 中创建一个“test_queue”并导出这些环境变量: + +```sh +export SQS_URL=https://YOUR_SQS_URL +export AWS_ACCESS_KEY_ID=YOUR_AWS_ACCESS_KEY_ID +export AWS_SECRET_ACCESS_KEY=YOUR_AWS_SECRET_ACCESS_KEY +export AWS_DEFAULT_REGION=YOUR_AWS_DEFAULT_REGION +``` + +然后运行: + +```sh +make test +``` + +如果未导出环境变量,`make test` 将仅运行单元测试。 diff --git a/docker-compose.test.yml b/docker-compose.test.yml index e9eb1965b..0f4b92d81 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -5,7 +5,7 @@ services: container_name: machinery_sut image: machinery_sut:latest volumes: - - "./:/go/src/github.com/RichardKnop/machinery" + - "./:/go/src/github.com/Michael-LiK/machinery" depends_on: - rabbitmq - redis diff --git a/example/amqp/main.go b/example/amqp/main.go index 3a6326931..b0bfa8a22 100644 --- a/example/amqp/main.go +++ b/example/amqp/main.go @@ -10,13 +10,13 @@ import ( "github.com/google/uuid" "github.com/urfave/cli" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/log" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/tasks" - exampletasks "github.com/RichardKnop/machinery/example/tasks" - tracers "github.com/RichardKnop/machinery/example/tracers" + exampletasks "github.com/Michael-LiK/machinery/example/tasks" + tracers "github.com/Michael-LiK/machinery/example/tracers" opentracing "github.com/opentracing/opentracing-go" opentracing_log "github.com/opentracing/opentracing-go/log" ) @@ -404,7 +404,7 @@ func send() error { return fmt.Errorf("Error creating chain: %s", err) } - chainAsyncResult, err := server.SendChainWithContext(ctx, chain) + chainAsyncResult, err := server.SendChainWithContext(ctx, chain, " ") if err != nil { return fmt.Errorf("Could not send chain: %s", err.Error()) } diff --git a/example/redis/main.go b/example/redis/main.go index 4b58c73fd..925fa0b37 100644 --- a/example/redis/main.go +++ b/example/redis/main.go @@ -10,13 +10,13 @@ import ( "github.com/google/uuid" "github.com/urfave/cli" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/log" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/tasks" - exampletasks "github.com/RichardKnop/machinery/example/tasks" - tracers "github.com/RichardKnop/machinery/example/tracers" + exampletasks "github.com/Michael-LiK/machinery/example/tasks" + tracers "github.com/Michael-LiK/machinery/example/tracers" opentracing "github.com/opentracing/opentracing-go" opentracing_log "github.com/opentracing/opentracing-go/log" ) diff --git a/example/tasks/tasks.go b/example/tasks/tasks.go index 7891533ae..d3c99766f 100644 --- a/example/tasks/tasks.go +++ b/example/tasks/tasks.go @@ -5,7 +5,7 @@ import ( "strings" "time" - "github.com/RichardKnop/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/log" ) // Add ... diff --git a/go.mod b/go.mod index 4a3321926..6ae5b2c65 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/RichardKnop/machinery +module github.com/Michael-LiK/machinery go 1.15 diff --git a/go.sum b/go.sum index 1d7f349f9..3d0503a85 100644 --- a/go.sum +++ b/go.sum @@ -13,7 +13,6 @@ cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKV cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0 h1:eWRCuwubtDrCJG0oSUMgnsbD4CmPFQF2ei4OFbXvwww= cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= @@ -175,7 +174,6 @@ github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -265,7 +263,6 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -291,7 +288,6 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5 h1:dntmOdLpSpHlVqbW5Eay97DelsZHe+55D+xC6i0dDS0= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.22.6 h1:BdkrbWrzDlV9dnbzoP7sfN+dHheJ4J9JOaYxcUDL+ok= go.opencensus.io v0.22.6/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= @@ -300,6 +296,7 @@ go.opentelemetry.io/otel v0.17.0 h1:6MKOu8WY4hmfpQ4oQn34u6rYhnf2sWf1LXYO/UFm71U= go.opentelemetry.io/otel v0.17.0/go.mod h1:Oqtdxmf7UtEvL037ohlgnaYa1h7GtMh0NcSd9eqkC9s= go.opentelemetry.io/otel/metric v0.17.0 h1:t+5EioN8YFXQ2EH+1j6FHCKMUj+57zIDSnSGr/mWuug= go.opentelemetry.io/otel/metric v0.17.0/go.mod h1:hUz9lH1rNXyEwWAhIWCMFWKhYtpASgSnObJFnU26dJ0= +go.opentelemetry.io/otel/oteltest v0.17.0 h1:TyAihUowTDLqb4+m5ePAsR71xPJaTBJl4KDArIdi9k4= go.opentelemetry.io/otel/oteltest v0.17.0/go.mod h1:JT/LGFxPwpN+nlsTiinSYjdIx3hZIGqHCpChcIZmdoE= go.opentelemetry.io/otel/trace v0.17.0 h1:SBOj64/GAOyWzs5F680yW1ITIfJkm6cJWL2YAvuL9xY= go.opentelemetry.io/otel/trace v0.17.0/go.mod h1:bIujpqg6ZL6xUTubIUgziI1jSaUPthmabA/ygf/6Cfg= @@ -334,7 +331,6 @@ golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHl golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5 h1:2M3HP5CCK1Si9FQhwnzYhXdG6DXeebvUHFpre8QvbyI= golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= @@ -380,9 +376,7 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U= golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= @@ -394,7 +388,6 @@ golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58 h1:Mj83v+wSRNEar42a/MQgxk9X42TdEmrOl9i+y8WbxLo= golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210113205817-d3ed898aa8a3/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= @@ -409,7 +402,6 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9 h1:SQFwaSi55rU7vdNs9Yr0Z324VNlrF+0wMqRXT4St8ck= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -456,7 +448,6 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091 h1:DMyOG0U+gKfu8JZzg2UQe9MeaC1X+xQWlAKcRnjxjCw= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk= @@ -468,7 +459,6 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -524,7 +514,6 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e h1:4nW4NLDYnU28ojHaHO8OVxFHk/aQ33U01a9cjED+pzE= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -551,7 +540,6 @@ google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0M google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0 h1:TBCmTTxUrRDA1iTctnK/fIeitxIZ+TQuaf0j29fmCGo= google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.38.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= @@ -616,7 +604,6 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.2 h1:EQyQC3sa8M+p6Ulc8yy9SWSS2GVwyRc83gAbG8lrl4o= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0 h1:TwIQcH3es+MojMVojxxfQ3l3OF2KzlRxML2xZq0kRo8= diff --git a/integration-tests/amqp_amqp_test.go b/integration-tests/amqp_amqp_test.go index 93295d148..9cc2df934 100644 --- a/integration-tests/amqp_amqp_test.go +++ b/integration-tests/amqp_amqp_test.go @@ -4,8 +4,8 @@ import ( "os" "testing" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" ) func TestAmqpAmqp(t *testing.T) { diff --git a/integration-tests/amqp_get_pending_tasks_test.go b/integration-tests/amqp_get_pending_tasks_test.go index 4247a9d0a..6f8200d1d 100644 --- a/integration-tests/amqp_get_pending_tasks_test.go +++ b/integration-tests/amqp_get_pending_tasks_test.go @@ -6,10 +6,10 @@ import ( "testing" "time" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/backends/result" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/backends/result" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/tasks" ) func TestAmqpGetPendingTasks(t *testing.T) { diff --git a/integration-tests/amqp_memcache_test.go b/integration-tests/amqp_memcache_test.go index f6574d8c9..b852b8984 100644 --- a/integration-tests/amqp_memcache_test.go +++ b/integration-tests/amqp_memcache_test.go @@ -5,8 +5,8 @@ import ( "os" "testing" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" ) func TestAmqpMemcache(t *testing.T) { diff --git a/integration-tests/amqp_mongodb_test.go b/integration-tests/amqp_mongodb_test.go index 9d872f445..e10eb286d 100644 --- a/integration-tests/amqp_mongodb_test.go +++ b/integration-tests/amqp_mongodb_test.go @@ -5,8 +5,8 @@ import ( "os" "testing" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" ) func TestAmqpMongodb(t *testing.T) { diff --git a/integration-tests/amqp_redis_test.go b/integration-tests/amqp_redis_test.go index 1ce4d26fa..b5bf7e3ce 100644 --- a/integration-tests/amqp_redis_test.go +++ b/integration-tests/amqp_redis_test.go @@ -5,8 +5,8 @@ import ( "os" "testing" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" ) func TestAmqpRedis(t *testing.T) { diff --git a/integration-tests/eager_eager_test.go b/integration-tests/eager_eager_test.go index e7498d0b0..040d855b5 100644 --- a/integration-tests/eager_eager_test.go +++ b/integration-tests/eager_eager_test.go @@ -5,9 +5,9 @@ import ( "testing" "time" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/stretchr/testify/suite" ) diff --git a/integration-tests/gcppubsub_redis_test.go b/integration-tests/gcppubsub_redis_test.go index 423abd739..c7f20722a 100644 --- a/integration-tests/gcppubsub_redis_test.go +++ b/integration-tests/gcppubsub_redis_test.go @@ -9,8 +9,8 @@ import ( "cloud.google.com/go/pubsub" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" ) func createGCPPubSubTopicAndSubscription(cli *pubsub.Client, topicName, subscriptionName string) { diff --git a/integration-tests/redis_get_pending_tasks_test.go b/integration-tests/redis_get_pending_tasks_test.go index 53214487e..e3c635956 100644 --- a/integration-tests/redis_get_pending_tasks_test.go +++ b/integration-tests/redis_get_pending_tasks_test.go @@ -5,7 +5,7 @@ import ( "os" "testing" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/config" ) func TestRedisGetPendingTasks(t *testing.T) { diff --git a/integration-tests/redis_memcache_test.go b/integration-tests/redis_memcache_test.go index 68870456c..89f16f408 100644 --- a/integration-tests/redis_memcache_test.go +++ b/integration-tests/redis_memcache_test.go @@ -5,8 +5,8 @@ import ( "os" "testing" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" ) func TestRedisMemcache(t *testing.T) { diff --git a/integration-tests/redis_mongodb_test.go b/integration-tests/redis_mongodb_test.go index b92ed5009..f2f204173 100644 --- a/integration-tests/redis_mongodb_test.go +++ b/integration-tests/redis_mongodb_test.go @@ -5,8 +5,8 @@ import ( "os" "testing" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" ) func TestRedisMongodb(t *testing.T) { diff --git a/integration-tests/redis_redis_test.go b/integration-tests/redis_redis_test.go index 58b654f58..6d51e7909 100644 --- a/integration-tests/redis_redis_test.go +++ b/integration-tests/redis_redis_test.go @@ -7,8 +7,8 @@ import ( "testing" "time" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" ) func TestRedisRedis_Redigo(t *testing.T) { diff --git a/integration-tests/redis_socket_test.go b/integration-tests/redis_socket_test.go index f46dca2ab..b7be43e23 100644 --- a/integration-tests/redis_socket_test.go +++ b/integration-tests/redis_socket_test.go @@ -5,8 +5,8 @@ import ( "os" "testing" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" ) func TestRedisSocket(t *testing.T) { diff --git a/integration-tests/sqs_amqp_test.go b/integration-tests/sqs_amqp_test.go index 552ef7dbe..62cde5723 100644 --- a/integration-tests/sqs_amqp_test.go +++ b/integration-tests/sqs_amqp_test.go @@ -4,8 +4,8 @@ import ( "os" "testing" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" ) func TestSQSAmqp(t *testing.T) { diff --git a/integration-tests/sqs_mongodb_test.go b/integration-tests/sqs_mongodb_test.go index da1237249..4741b224b 100644 --- a/integration-tests/sqs_mongodb_test.go +++ b/integration-tests/sqs_mongodb_test.go @@ -5,8 +5,8 @@ import ( "os" "testing" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" ) func TestSQSMongodb(t *testing.T) { diff --git a/integration-tests/suite_test.go b/integration-tests/suite_test.go index 0e99d1cf4..1e1961ecd 100644 --- a/integration-tests/suite_test.go +++ b/integration-tests/suite_test.go @@ -11,12 +11,12 @@ import ( "github.com/stretchr/testify/assert" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/backends/result" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/backends/result" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/tasks" - brokersiface "github.com/RichardKnop/machinery/v1/brokers/iface" + brokersiface "github.com/Michael-LiK/machinery/v1/brokers/iface" ) type ascendingInt64s []int64 diff --git a/integration-tests/worker_only_consumes_registered_tasks_test.go b/integration-tests/worker_only_consumes_registered_tasks_test.go index 76c12bc5e..6762b4268 100644 --- a/integration-tests/worker_only_consumes_registered_tasks_test.go +++ b/integration-tests/worker_only_consumes_registered_tasks_test.go @@ -8,9 +8,9 @@ import ( "testing" "time" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/tasks" ) func TestWorkerOnlyConsumesRegisteredTaskAMQP(t *testing.T) { diff --git a/v1/backends/amqp/amqp.go b/v1/backends/amqp/amqp.go index eb1adebf4..e76e413d7 100644 --- a/v1/backends/amqp/amqp.go +++ b/v1/backends/amqp/amqp.go @@ -20,11 +20,11 @@ import ( "errors" "fmt" - "github.com/RichardKnop/machinery/v1/backends/iface" - "github.com/RichardKnop/machinery/v1/common" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/log" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/backends/iface" + "github.com/Michael-LiK/machinery/v1/common" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/streadway/amqp" ) @@ -44,6 +44,11 @@ func (b *Backend) InitGroup(groupUUID string, taskUUIDs []string) error { return nil } +// InitChain creates and saves a chain meta data object +func (b *Backend) InitChain(chainUUID string, taskUUIDs []string, mainId string) error { + return nil +} + // GroupCompleted returns true if all tasks in a group finished // NOTE: Given AMQP limitation this will only return true if all finished // tasks were successful as we do not keep track of completed failed tasks diff --git a/v1/backends/amqp/amqp_test.go b/v1/backends/amqp/amqp_test.go index 2e440d834..4c689f30b 100644 --- a/v1/backends/amqp/amqp_test.go +++ b/v1/backends/amqp/amqp_test.go @@ -5,9 +5,9 @@ import ( "testing" "time" - "github.com/RichardKnop/machinery/v1/backends/amqp" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/backends/amqp" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v1/backends/dynamodb/dynamodb.go b/v1/backends/dynamodb/dynamodb.go index a2a4a9bfb..fcb33f3c3 100644 --- a/v1/backends/dynamodb/dynamodb.go +++ b/v1/backends/dynamodb/dynamodb.go @@ -8,11 +8,11 @@ import ( "github.com/aws/aws-sdk-go/aws/session" - "github.com/RichardKnop/machinery/v1/backends/iface" - "github.com/RichardKnop/machinery/v1/common" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/log" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/backends/iface" + "github.com/Michael-LiK/machinery/v1/common" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute" @@ -78,6 +78,33 @@ func (b *Backend) InitGroup(groupUUID string, taskUUIDs []string) error { return nil } +// InitChain ... +func (b *Backend) InitChain(chainUUID string, taskUUIDs []string, mainId string) error { + meta := tasks.ChainMeta{ + ChainUUID: chainUUID, + TaskUUIDs: taskUUIDs, + MainId: mainId, + CreatedAt: time.Now().UTC(), + TTL: b.getExpirationTime(), + } + av, err := dynamodbattribute.MarshalMap(meta) + if err != nil { + log.ERROR.Printf("Error when marshaling Dynamodb attributes. Err: %v", err) + return err + } + input := &dynamodb.PutItemInput{ + Item: av, + TableName: aws.String(b.cnf.DynamoDB.GroupMetasTable), + } + _, err = b.client.PutItem(input) + + if err != nil { + log.ERROR.Printf("Got error when calling PutItem: %v; Error: %v", input, err) + return err + } + return nil +} + // GroupCompleted ... func (b *Backend) GroupCompleted(groupUUID string, groupTaskCount int) (bool, error) { groupMeta, err := b.getGroupMeta(groupUUID) diff --git a/v1/backends/dynamodb/dynamodb_export_test.go b/v1/backends/dynamodb/dynamodb_export_test.go index 38e2935b1..19acc6ab7 100644 --- a/v1/backends/dynamodb/dynamodb_export_test.go +++ b/v1/backends/dynamodb/dynamodb_export_test.go @@ -4,8 +4,8 @@ import ( "errors" "os" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface" diff --git a/v1/backends/dynamodb/dynamodb_test.go b/v1/backends/dynamodb/dynamodb_test.go index 41c3ea153..3b8c96240 100644 --- a/v1/backends/dynamodb/dynamodb_test.go +++ b/v1/backends/dynamodb/dynamodb_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - "github.com/RichardKnop/machinery/v1/backends/dynamodb" - "github.com/RichardKnop/machinery/v1/log" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/backends/dynamodb" + "github.com/Michael-LiK/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/aws/aws-sdk-go/aws" "github.com/stretchr/testify/assert" diff --git a/v1/backends/eager/eager.go b/v1/backends/eager/eager.go index 6fb6bf100..1bfed46d6 100644 --- a/v1/backends/eager/eager.go +++ b/v1/backends/eager/eager.go @@ -6,10 +6,10 @@ import ( "fmt" "sync" - "github.com/RichardKnop/machinery/v1/backends/iface" - "github.com/RichardKnop/machinery/v1/common" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/backends/iface" + "github.com/Michael-LiK/machinery/v1/common" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/tasks" ) // ErrGroupNotFound ... @@ -46,6 +46,7 @@ func (e ErrTasknotFound) Error() string { type Backend struct { common.Backend groups map[string][]string + chains map[string][]string tasks map[string][]byte stateMutex sync.Mutex } @@ -55,6 +56,7 @@ func New() iface.Backend { return &Backend{ Backend: common.NewBackend(new(config.Config)), groups: make(map[string][]string), + chains: make(map[string][]string), tasks: make(map[string][]byte), } } @@ -69,6 +71,16 @@ func (b *Backend) InitGroup(groupUUID string, taskUUIDs []string) error { return nil } +// InitChain creates and saves a chain meta data object +func (b *Backend) InitChain(chainUUID string, taskUUIDs []string, mainId string) error { + tasks := make([]string, 0, len(taskUUIDs)) + // copy every task + tasks = append(tasks, taskUUIDs...) + + b.chains[chainUUID] = tasks + return nil +} + // GroupCompleted returns true if all tasks in a group finished func (b *Backend) GroupCompleted(groupUUID string, groupTaskCount int) (bool, error) { tasks, ok := b.groups[groupUUID] diff --git a/v1/backends/eager/eager_test.go b/v1/backends/eager/eager_test.go index 274f33841..d1f13c309 100644 --- a/v1/backends/eager/eager_test.go +++ b/v1/backends/eager/eager_test.go @@ -4,9 +4,9 @@ import ( "encoding/json" "testing" - "github.com/RichardKnop/machinery/v1/backends/eager" - "github.com/RichardKnop/machinery/v1/backends/iface" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/backends/eager" + "github.com/Michael-LiK/machinery/v1/backends/iface" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/stretchr/testify/suite" ) diff --git a/v1/backends/iface/interfaces.go b/v1/backends/iface/interfaces.go index 56dff517b..629a08fe5 100644 --- a/v1/backends/iface/interfaces.go +++ b/v1/backends/iface/interfaces.go @@ -1,7 +1,7 @@ package iface import ( - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/tasks" ) // Backend - a common interface for all result backends @@ -11,6 +11,8 @@ type Backend interface { GroupCompleted(groupUUID string, groupTaskCount int) (bool, error) GroupTaskStates(groupUUID string, groupTaskCount int) ([]*tasks.TaskState, error) TriggerChord(groupUUID string) (bool, error) + // Chain related functions + InitChain(chainUUID string, taskUUIDs []string, mainId string) error // Setting / getting task state SetStatePending(signature *tasks.Signature) error diff --git a/v1/backends/memcache/memcache.go b/v1/backends/memcache/memcache.go index e6cc10fd2..22f9a51ce 100644 --- a/v1/backends/memcache/memcache.go +++ b/v1/backends/memcache/memcache.go @@ -5,11 +5,11 @@ import ( "encoding/json" "time" - "github.com/RichardKnop/machinery/v1/backends/iface" - "github.com/RichardKnop/machinery/v1/common" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/log" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/backends/iface" + "github.com/Michael-LiK/machinery/v1/common" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/tasks" gomemcache "github.com/bradfitz/gomemcache/memcache" ) @@ -49,6 +49,27 @@ func (b *Backend) InitGroup(groupUUID string, taskUUIDs []string) error { }) } +// InitChain creates and saves a chain meta data object +func (b *Backend) InitChain(chainUUID string, taskUUIDs []string, mainId string) error { + chainMeta := &tasks.ChainMeta{ + ChainUUID: chainUUID, + TaskUUIDs: taskUUIDs, + MainId: mainId, + CreatedAt: time.Now().UTC(), + } + + encoded, err := json.Marshal(&chainMeta) + if err != nil { + return err + } + + return b.getClient().Set(&gomemcache.Item{ + Key: chainUUID, + Value: encoded, + Expiration: b.getExpirationTimestamp(), + }) +} + // GroupCompleted returns true if all tasks in a group finished func (b *Backend) GroupCompleted(groupUUID string, groupTaskCount int) (bool, error) { groupMeta, err := b.getGroupMeta(groupUUID) diff --git a/v1/backends/memcache/memcache_test.go b/v1/backends/memcache/memcache_test.go index 0f4000da0..2bcb0b3bc 100644 --- a/v1/backends/memcache/memcache_test.go +++ b/v1/backends/memcache/memcache_test.go @@ -5,9 +5,9 @@ import ( "testing" "time" - "github.com/RichardKnop/machinery/v1/backends/memcache" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/backends/memcache" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v1/backends/mongo/mongodb.go b/v1/backends/mongo/mongodb.go index bdbf21ee3..b698e1b78 100644 --- a/v1/backends/mongo/mongodb.go +++ b/v1/backends/mongo/mongodb.go @@ -13,11 +13,11 @@ import ( "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" - "github.com/RichardKnop/machinery/v1/backends/iface" - "github.com/RichardKnop/machinery/v1/common" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/log" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/backends/iface" + "github.com/Michael-LiK/machinery/v1/common" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/tasks" ) // Backend represents a MongoDB result backend @@ -26,6 +26,7 @@ type Backend struct { client *mongo.Client tc *mongo.Collection gmc *mongo.Collection + cmc *mongo.Collection once sync.Once } @@ -50,6 +51,18 @@ func (b *Backend) InitGroup(groupUUID string, taskUUIDs []string) error { return err } +// InitGroup creates and saves a group meta data object +func (b *Backend) InitChain(chainUUID string, taskUUIDs []string, mainId string) error { + chainMeta := &tasks.ChainMeta{ + ChainUUID: chainUUID, + TaskUUIDs: taskUUIDs, + MainId: mainId, + CreatedAt: time.Now().UTC(), + } + _, err := b.chainMetasCollection().InsertOne(context.Background(), chainMeta) + return err +} + // GroupCompleted returns true if all tasks in a group finished func (b *Backend) GroupCompleted(groupUUID string, groupTaskCount int) (bool, error) { groupMeta, err := b.getGroupMeta(groupUUID) @@ -279,6 +292,14 @@ func (b *Backend) groupMetasCollection() *mongo.Collection { return b.gmc } +func (b *Backend) chainMetasCollection() *mongo.Collection { + b.once.Do(func() { + b.connect() + }) + + return b.cmc +} + // connect creates the underlying mgo connection if it doesn't exist // creates required indexes for our collections func (b *Backend) connect() error { @@ -296,6 +317,7 @@ func (b *Backend) connect() error { b.tc = b.client.Database(database).Collection("tasks") b.gmc = b.client.Database(database).Collection("group_metas") + b.cmc = b.client.Database(database).Collection("chain_metas") err = b.createMongoIndexes(database) if err != nil { diff --git a/v1/backends/mongo/mongodb_test.go b/v1/backends/mongo/mongodb_test.go index e8c36765b..619af68c5 100644 --- a/v1/backends/mongo/mongodb_test.go +++ b/v1/backends/mongo/mongodb_test.go @@ -4,15 +4,16 @@ import ( "os" "testing" - "github.com/RichardKnop/machinery/v1/backends/iface" - "github.com/RichardKnop/machinery/v1/backends/mongo" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/backends/iface" + "github.com/Michael-LiK/machinery/v1/backends/mongo" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/stretchr/testify/assert" ) var ( groupUUID = "123456" + chainUUID = "666666" taskUUIDs = []string{"1", "2", "3"} ) @@ -34,6 +35,10 @@ func newBackend() (iface.Backend, error) { if err := backend.InitGroup(groupUUID, taskUUIDs); err != nil { return nil, err } + + if err := backend.InitChain(chainUUID, taskUUIDs); err != nil { + return nil, err + } return backend, nil } diff --git a/v1/backends/null/null.go b/v1/backends/null/null.go index ab5f47a0e..b02f6f14e 100644 --- a/v1/backends/null/null.go +++ b/v1/backends/null/null.go @@ -3,10 +3,10 @@ package null import ( "fmt" - "github.com/RichardKnop/machinery/v1/backends/iface" - "github.com/RichardKnop/machinery/v1/common" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/backends/iface" + "github.com/Michael-LiK/machinery/v1/common" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/tasks" ) // ErrGroupNotFound ... @@ -43,6 +43,8 @@ func (e ErrTasknotFound) Error() string { type Backend struct { common.Backend groups map[string]struct{} + chains map[string]struct{} + } // New creates NullBackend instance @@ -59,6 +61,12 @@ func (b *Backend) InitGroup(groupUUID string, taskUUIDs []string) error { return nil } +func (b *Backend) InitChain(chainUUID string, taskUUIDs []string, mainId string) error { + b.chains[chainUUID] = struct{}{} + return nil +} + + // GroupCompleted returns true (always) func (b *Backend) GroupCompleted(groupUUID string, groupTaskCount int) (bool, error) { _, ok := b.groups[groupUUID] diff --git a/v1/backends/redis/goredis.go b/v1/backends/redis/goredis.go index 95cceb716..7f0353444 100644 --- a/v1/backends/redis/goredis.go +++ b/v1/backends/redis/goredis.go @@ -12,11 +12,11 @@ import ( "github.com/go-redsync/redsync/v4" redsyncgoredis "github.com/go-redsync/redsync/v4/redis/goredis/v8" - "github.com/RichardKnop/machinery/v1/backends/iface" - "github.com/RichardKnop/machinery/v1/common" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/log" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/backends/iface" + "github.com/Michael-LiK/machinery/v1/common" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/tasks" ) // BackendGR represents a Redis result backend @@ -38,10 +38,10 @@ func NewGR(cnf *config.Config, addrs []string, db int) iface.Backend { Backend: common.NewBackend(cnf), } parts := strings.Split(addrs[0], "@") - if len(parts) >= 2 { + if len(parts) == 2 { // with passwrod - b.password = strings.Join(parts[:len(parts)-1], "@") - addrs[0] = parts[len(parts)-1] // addr is the last one without @ + b.password = parts[0] + addrs[0] = parts[1] } ropt := &redis.UniversalOptions{ @@ -85,6 +85,29 @@ func (b *BackendGR) InitGroup(groupUUID string, taskUUIDs []string) error { return nil } +// InitChain creates and saves a group meta data object +func (b *BackendGR) InitChain(chainUUID string, taskUUIDs []string, mainId string) error { + chianMeta := &tasks.ChainMeta{ + ChainUUID: chainUUID, + TaskUUIDs: taskUUIDs, + MainId: mainId, + CreatedAt: time.Now().UTC(), + } + + encoded, err := json.Marshal(chianMeta) + if err != nil { + return err + } + + expiration := b.getExpiration() + err = b.rclient.Set(context.Background(), chainUUID, encoded, expiration).Err() + if err != nil { + return err + } + + return nil +} + // GroupCompleted returns true if all tasks in a group finished func (b *BackendGR) GroupCompleted(groupUUID string, groupTaskCount int) (bool, error) { groupMeta, err := b.getGroupMeta(groupUUID) diff --git a/v1/backends/redis/goredis_test.go b/v1/backends/redis/goredis_test.go index 425c8e8ee..06c29afe9 100644 --- a/v1/backends/redis/goredis_test.go +++ b/v1/backends/redis/goredis_test.go @@ -1,14 +1,14 @@ package redis_test import ( - "github.com/RichardKnop/machinery/v1/backends/iface" + "github.com/Michael-LiK/machinery/v1/backends/iface" "os" "strings" "testing" - "github.com/RichardKnop/machinery/v1/backends/redis" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/backends/redis" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v1/backends/redis/redis.go b/v1/backends/redis/redis.go index 232dc313c..c7d846286 100644 --- a/v1/backends/redis/redis.go +++ b/v1/backends/redis/redis.go @@ -11,11 +11,11 @@ import ( redsyncredis "github.com/go-redsync/redsync/v4/redis/redigo" "github.com/gomodule/redigo/redis" - "github.com/RichardKnop/machinery/v1/backends/iface" - "github.com/RichardKnop/machinery/v1/common" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/log" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/backends/iface" + "github.com/Michael-LiK/machinery/v1/common" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/tasks" ) // Backend represents a Redis result backend @@ -68,6 +68,32 @@ func (b *Backend) InitGroup(groupUUID string, taskUUIDs []string) error { return nil } +// InitGroup creates and saves a chain meta data object +func (b *Backend) InitChain(chainUUID string, taskUUIDs []string, mainId string) error { + chainMeta := &tasks.ChainMeta{ + ChainUUID: chainUUID, + TaskUUIDs: taskUUIDs, + MainId: mainId, + CreatedAt: time.Now().UTC(), + } + + encoded, err := json.Marshal(chainMeta) + if err != nil { + return err + } + + conn := b.open() + defer conn.Close() + + expiration := int64(b.getExpiration().Seconds()) + _, err = conn.Do("SET", chainUUID, encoded, "EX", expiration) + if err != nil { + return err + } + + return nil +} + // GroupCompleted returns true if all tasks in a group finished func (b *Backend) GroupCompleted(groupUUID string, groupTaskCount int) (bool, error) { conn := b.open() diff --git a/v1/backends/redis/redis_test.go b/v1/backends/redis/redis_test.go index 3e275829b..1ee8ea7f9 100644 --- a/v1/backends/redis/redis_test.go +++ b/v1/backends/redis/redis_test.go @@ -4,9 +4,9 @@ import ( "os" "testing" - "github.com/RichardKnop/machinery/v1/backends/redis" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/backends/redis" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v1/backends/result/async_result.go b/v1/backends/result/async_result.go index 99891150d..48e816750 100644 --- a/v1/backends/result/async_result.go +++ b/v1/backends/result/async_result.go @@ -5,8 +5,8 @@ import ( "reflect" "time" - "github.com/RichardKnop/machinery/v1/backends/iface" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/backends/iface" + "github.com/Michael-LiK/machinery/v1/tasks" ) var ( diff --git a/v1/brokers/amqp/amqp.go b/v1/brokers/amqp/amqp.go index 5edcb81cf..e8f12f539 100644 --- a/v1/brokers/amqp/amqp.go +++ b/v1/brokers/amqp/amqp.go @@ -8,12 +8,12 @@ import ( "sync" "time" - "github.com/RichardKnop/machinery/v1/brokers/errs" - "github.com/RichardKnop/machinery/v1/brokers/iface" - "github.com/RichardKnop/machinery/v1/common" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/log" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/brokers/errs" + "github.com/Michael-LiK/machinery/v1/brokers/iface" + "github.com/Michael-LiK/machinery/v1/common" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/pkg/errors" "github.com/streadway/amqp" ) diff --git a/v1/brokers/amqp/amqp_concurrence_test.go b/v1/brokers/amqp/amqp_concurrence_test.go index 5522a8a38..9377997b0 100644 --- a/v1/brokers/amqp/amqp_concurrence_test.go +++ b/v1/brokers/amqp/amqp_concurrence_test.go @@ -2,9 +2,9 @@ package amqp import ( "fmt" - "github.com/RichardKnop/machinery/v1/brokers/iface" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/brokers/iface" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/streadway/amqp" "testing" "time" diff --git a/v1/brokers/amqp/amqp_test.go b/v1/brokers/amqp/amqp_test.go index 971323ddd..a78fc92b0 100644 --- a/v1/brokers/amqp/amqp_test.go +++ b/v1/brokers/amqp/amqp_test.go @@ -3,10 +3,10 @@ package amqp_test import ( "testing" - "github.com/RichardKnop/machinery/v1/brokers/amqp" - "github.com/RichardKnop/machinery/v1/brokers/iface" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/brokers/amqp" + "github.com/Michael-LiK/machinery/v1/brokers/iface" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v1/brokers/eager/eager.go b/v1/brokers/eager/eager.go index 3726b70d9..d6efefa4a 100644 --- a/v1/brokers/eager/eager.go +++ b/v1/brokers/eager/eager.go @@ -7,9 +7,9 @@ import ( "errors" "fmt" - "github.com/RichardKnop/machinery/v1/brokers/iface" - "github.com/RichardKnop/machinery/v1/common" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/brokers/iface" + "github.com/Michael-LiK/machinery/v1/common" + "github.com/Michael-LiK/machinery/v1/tasks" ) // Broker represents an "eager" in-memory broker diff --git a/v1/brokers/gcppubsub/gcp_pubsub.go b/v1/brokers/gcppubsub/gcp_pubsub.go index 5e374a9b3..92a2c490f 100644 --- a/v1/brokers/gcppubsub/gcp_pubsub.go +++ b/v1/brokers/gcppubsub/gcp_pubsub.go @@ -8,11 +8,11 @@ import ( "time" "cloud.google.com/go/pubsub" - "github.com/RichardKnop/machinery/v1/brokers/iface" - "github.com/RichardKnop/machinery/v1/common" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/log" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/brokers/iface" + "github.com/Michael-LiK/machinery/v1/common" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/tasks" ) // Broker represents an Google Cloud Pub/Sub broker diff --git a/v1/brokers/iface/interfaces.go b/v1/brokers/iface/interfaces.go index c15e8f720..9feace475 100644 --- a/v1/brokers/iface/interfaces.go +++ b/v1/brokers/iface/interfaces.go @@ -3,8 +3,8 @@ package iface import ( "context" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/tasks" ) // Broker - a common interface for all brokers diff --git a/v1/brokers/redis/goredis.go b/v1/brokers/redis/goredis.go index 7cf2e66b6..df06361a2 100644 --- a/v1/brokers/redis/goredis.go +++ b/v1/brokers/redis/goredis.go @@ -14,12 +14,12 @@ import ( "github.com/go-redis/redis/v8" "github.com/go-redsync/redsync/v4" - "github.com/RichardKnop/machinery/v1/brokers/errs" - "github.com/RichardKnop/machinery/v1/brokers/iface" - "github.com/RichardKnop/machinery/v1/common" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/log" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/brokers/errs" + "github.com/Michael-LiK/machinery/v1/brokers/iface" + "github.com/Michael-LiK/machinery/v1/common" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/tasks" ) // BrokerGR represents a Redis broker diff --git a/v1/brokers/redis/redis.go b/v1/brokers/redis/redis.go index 1683f13e6..413f8358d 100644 --- a/v1/brokers/redis/redis.go +++ b/v1/brokers/redis/redis.go @@ -14,12 +14,12 @@ import ( redsyncredis "github.com/go-redsync/redsync/v4/redis/redigo" "github.com/gomodule/redigo/redis" - "github.com/RichardKnop/machinery/v1/brokers/errs" - "github.com/RichardKnop/machinery/v1/brokers/iface" - "github.com/RichardKnop/machinery/v1/common" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/log" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/brokers/errs" + "github.com/Michael-LiK/machinery/v1/brokers/iface" + "github.com/Michael-LiK/machinery/v1/common" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/tasks" ) const defaultRedisDelayedTasksKey = "delayed_tasks" diff --git a/v1/brokers/sqs/sqs.go b/v1/brokers/sqs/sqs.go index f811e16e5..a1f60abee 100644 --- a/v1/brokers/sqs/sqs.go +++ b/v1/brokers/sqs/sqs.go @@ -9,12 +9,12 @@ import ( "sync" "time" - "github.com/RichardKnop/machinery/v1/brokers/errs" - "github.com/RichardKnop/machinery/v1/brokers/iface" - "github.com/RichardKnop/machinery/v1/common" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/log" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/brokers/errs" + "github.com/Michael-LiK/machinery/v1/brokers/iface" + "github.com/Michael-LiK/machinery/v1/common" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sqs/sqsiface" diff --git a/v1/brokers/sqs/sqs_export_test.go b/v1/brokers/sqs/sqs_export_test.go index 4c42c60c8..9ebfb92cc 100644 --- a/v1/brokers/sqs/sqs_export_test.go +++ b/v1/brokers/sqs/sqs_export_test.go @@ -11,9 +11,9 @@ import ( "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sqs/sqsiface" - "github.com/RichardKnop/machinery/v1/brokers/iface" - "github.com/RichardKnop/machinery/v1/common" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/brokers/iface" + "github.com/Michael-LiK/machinery/v1/common" + "github.com/Michael-LiK/machinery/v1/config" awssqs "github.com/aws/aws-sdk-go/service/sqs" ) diff --git a/v1/brokers/sqs/sqs_test.go b/v1/brokers/sqs/sqs_test.go index aa3084c30..595069198 100644 --- a/v1/brokers/sqs/sqs_test.go +++ b/v1/brokers/sqs/sqs_test.go @@ -10,10 +10,10 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/stretchr/testify/assert" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/brokers/sqs" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/retry" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/brokers/sqs" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/retry" awssqs "github.com/aws/aws-sdk-go/service/sqs" ) diff --git a/v1/common/backend.go b/v1/common/backend.go index 6c6b38be0..4dfee53aa 100644 --- a/v1/common/backend.go +++ b/v1/common/backend.go @@ -1,7 +1,7 @@ package common import ( - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/config" ) // Backend represents a base backend structure diff --git a/v1/common/broker.go b/v1/common/broker.go index 1846eb27f..75e7b54a9 100644 --- a/v1/common/broker.go +++ b/v1/common/broker.go @@ -4,11 +4,11 @@ import ( "errors" "sync" - "github.com/RichardKnop/machinery/v1/brokers/iface" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/log" - "github.com/RichardKnop/machinery/v1/retry" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/brokers/iface" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/retry" + "github.com/Michael-LiK/machinery/v1/tasks" ) type registeredTaskNames struct { diff --git a/v1/common/broker_test.go b/v1/common/broker_test.go index 8aec32777..fcca30500 100644 --- a/v1/common/broker_test.go +++ b/v1/common/broker_test.go @@ -3,10 +3,10 @@ package common_test import ( "testing" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/common" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/common" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v1/common/redis.go b/v1/common/redis.go index 6cfefb02e..189016fbf 100644 --- a/v1/common/redis.go +++ b/v1/common/redis.go @@ -6,7 +6,7 @@ import ( "github.com/gomodule/redigo/redis" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/config" ) var ( diff --git a/v1/config/env.go b/v1/config/env.go index efdce4eaf..dd17a1dbf 100644 --- a/v1/config/env.go +++ b/v1/config/env.go @@ -3,7 +3,7 @@ package config import ( "github.com/kelseyhightower/envconfig" - "github.com/RichardKnop/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/log" ) // NewFromEnvironment creates a config object from environment variables diff --git a/v1/config/env_test.go b/v1/config/env_test.go index e84580da4..86fb9579b 100644 --- a/v1/config/env_test.go +++ b/v1/config/env_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/config" "github.com/stretchr/testify/assert" ) diff --git a/v1/config/file.go b/v1/config/file.go index d18622614..578b20917 100644 --- a/v1/config/file.go +++ b/v1/config/file.go @@ -5,7 +5,7 @@ import ( "os" "time" - "github.com/RichardKnop/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/log" "gopkg.in/yaml.v2" ) diff --git a/v1/config/file_test.go b/v1/config/file_test.go index 59618c01d..f06501370 100644 --- a/v1/config/file_test.go +++ b/v1/config/file_test.go @@ -3,7 +3,7 @@ package config_test import ( "testing" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/config" "github.com/stretchr/testify/assert" ) diff --git a/v1/factories.go b/v1/factories.go index 907cf56e0..d5b40f907 100644 --- a/v1/factories.go +++ b/v1/factories.go @@ -9,27 +9,27 @@ import ( neturl "net/url" - "github.com/RichardKnop/machinery/v1/config" - - amqpbroker "github.com/RichardKnop/machinery/v1/brokers/amqp" - eagerbroker "github.com/RichardKnop/machinery/v1/brokers/eager" - gcppubsubbroker "github.com/RichardKnop/machinery/v1/brokers/gcppubsub" - brokeriface "github.com/RichardKnop/machinery/v1/brokers/iface" - redisbroker "github.com/RichardKnop/machinery/v1/brokers/redis" - sqsbroker "github.com/RichardKnop/machinery/v1/brokers/sqs" - - amqpbackend "github.com/RichardKnop/machinery/v1/backends/amqp" - dynamobackend "github.com/RichardKnop/machinery/v1/backends/dynamodb" - eagerbackend "github.com/RichardKnop/machinery/v1/backends/eager" - backendiface "github.com/RichardKnop/machinery/v1/backends/iface" - memcachebackend "github.com/RichardKnop/machinery/v1/backends/memcache" - mongobackend "github.com/RichardKnop/machinery/v1/backends/mongo" - nullbackend "github.com/RichardKnop/machinery/v1/backends/null" - redisbackend "github.com/RichardKnop/machinery/v1/backends/redis" - - eagerlock "github.com/RichardKnop/machinery/v1/locks/eager" - lockiface "github.com/RichardKnop/machinery/v1/locks/iface" - redislock "github.com/RichardKnop/machinery/v1/locks/redis" + "github.com/Michael-LiK/machinery/v1/config" + + amqpbroker "github.com/Michael-LiK/machinery/v1/brokers/amqp" + eagerbroker "github.com/Michael-LiK/machinery/v1/brokers/eager" + gcppubsubbroker "github.com/Michael-LiK/machinery/v1/brokers/gcppubsub" + brokeriface "github.com/Michael-LiK/machinery/v1/brokers/iface" + redisbroker "github.com/Michael-LiK/machinery/v1/brokers/redis" + sqsbroker "github.com/Michael-LiK/machinery/v1/brokers/sqs" + + amqpbackend "github.com/Michael-LiK/machinery/v1/backends/amqp" + dynamobackend "github.com/Michael-LiK/machinery/v1/backends/dynamodb" + eagerbackend "github.com/Michael-LiK/machinery/v1/backends/eager" + backendiface "github.com/Michael-LiK/machinery/v1/backends/iface" + memcachebackend "github.com/Michael-LiK/machinery/v1/backends/memcache" + mongobackend "github.com/Michael-LiK/machinery/v1/backends/mongo" + nullbackend "github.com/Michael-LiK/machinery/v1/backends/null" + redisbackend "github.com/Michael-LiK/machinery/v1/backends/redis" + + eagerlock "github.com/Michael-LiK/machinery/v1/locks/eager" + lockiface "github.com/Michael-LiK/machinery/v1/locks/iface" + redislock "github.com/Michael-LiK/machinery/v1/locks/redis" ) // BrokerFactory creates a new object of iface.Broker diff --git a/v1/factories_test.go b/v1/factories_test.go index 6ea911a9c..21e2942e6 100644 --- a/v1/factories_test.go +++ b/v1/factories_test.go @@ -8,19 +8,19 @@ import ( "testing" "unsafe" - machinery "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/config" + machinery "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" "github.com/stretchr/testify/assert" - amqpbroker "github.com/RichardKnop/machinery/v1/brokers/amqp" - brokeriface "github.com/RichardKnop/machinery/v1/brokers/iface" - redisbroker "github.com/RichardKnop/machinery/v1/brokers/redis" - sqsbroker "github.com/RichardKnop/machinery/v1/brokers/sqs" + amqpbroker "github.com/Michael-LiK/machinery/v1/brokers/amqp" + brokeriface "github.com/Michael-LiK/machinery/v1/brokers/iface" + redisbroker "github.com/Michael-LiK/machinery/v1/brokers/redis" + sqsbroker "github.com/Michael-LiK/machinery/v1/brokers/sqs" - amqpbackend "github.com/RichardKnop/machinery/v1/backends/amqp" - memcachebackend "github.com/RichardKnop/machinery/v1/backends/memcache" - mongobackend "github.com/RichardKnop/machinery/v1/backends/mongo" - redisbackend "github.com/RichardKnop/machinery/v1/backends/redis" + amqpbackend "github.com/Michael-LiK/machinery/v1/backends/amqp" + memcachebackend "github.com/Michael-LiK/machinery/v1/backends/memcache" + mongobackend "github.com/Michael-LiK/machinery/v1/backends/mongo" + redisbackend "github.com/Michael-LiK/machinery/v1/backends/redis" ) var ( diff --git a/v1/locks/eager/eager_test.go b/v1/locks/eager/eager_test.go index b3b2f9666..1623264c0 100644 --- a/v1/locks/eager/eager_test.go +++ b/v1/locks/eager/eager_test.go @@ -1,8 +1,8 @@ package eager import ( - lockiface "github.com/RichardKnop/machinery/v1/locks/iface" - "github.com/RichardKnop/machinery/v1/utils" + lockiface "github.com/Michael-LiK/machinery/v1/locks/iface" + "github.com/Michael-LiK/machinery/v1/utils" "github.com/stretchr/testify/assert" "testing" "time" diff --git a/v1/locks/redis/redis.go b/v1/locks/redis/redis.go index db331508d..64c441511 100644 --- a/v1/locks/redis/redis.go +++ b/v1/locks/redis/redis.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/config" "github.com/go-redis/redis/v8" ) diff --git a/v1/log/log_test.go b/v1/log/log_test.go index 64c172db2..98dcce0a5 100644 --- a/v1/log/log_test.go +++ b/v1/log/log_test.go @@ -3,7 +3,7 @@ package log_test import ( "testing" - "github.com/RichardKnop/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/log" ) func TestDefaultLogger(t *testing.T) { diff --git a/v1/retry/fibonacci_test.go b/v1/retry/fibonacci_test.go index a82b2467e..2982ce24d 100644 --- a/v1/retry/fibonacci_test.go +++ b/v1/retry/fibonacci_test.go @@ -3,7 +3,7 @@ package retry_test import ( "testing" - "github.com/RichardKnop/machinery/v1/retry" + "github.com/Michael-LiK/machinery/v1/retry" "github.com/stretchr/testify/assert" ) diff --git a/v1/retry/retry.go b/v1/retry/retry.go index 11076dfd8..65cf365ff 100644 --- a/v1/retry/retry.go +++ b/v1/retry/retry.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/RichardKnop/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/log" ) // Closure - a useful closure we can use when there is a problem diff --git a/v1/server.go b/v1/server.go index e7a1f84a2..317ee6608 100644 --- a/v1/server.go +++ b/v1/server.go @@ -10,17 +10,17 @@ import ( "github.com/google/uuid" "github.com/robfig/cron/v3" - "github.com/RichardKnop/machinery/v1/backends/result" - "github.com/RichardKnop/machinery/v1/brokers/eager" - "github.com/RichardKnop/machinery/v1/config" - "github.com/RichardKnop/machinery/v1/log" - "github.com/RichardKnop/machinery/v1/tasks" - "github.com/RichardKnop/machinery/v1/tracing" - "github.com/RichardKnop/machinery/v1/utils" - - backendsiface "github.com/RichardKnop/machinery/v1/backends/iface" - brokersiface "github.com/RichardKnop/machinery/v1/brokers/iface" - lockiface "github.com/RichardKnop/machinery/v1/locks/iface" + "github.com/Michael-LiK/machinery/v1/backends/result" + "github.com/Michael-LiK/machinery/v1/brokers/eager" + "github.com/Michael-LiK/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/tracing" + "github.com/Michael-LiK/machinery/v1/utils" + + backendsiface "github.com/Michael-LiK/machinery/v1/backends/iface" + brokersiface "github.com/Michael-LiK/machinery/v1/brokers/iface" + lockiface "github.com/Michael-LiK/machinery/v1/locks/iface" opentracing "github.com/opentracing/opentracing-go" ) @@ -218,22 +218,28 @@ func (server *Server) SendTask(signature *tasks.Signature) (*result.AsyncResult, } // SendChainWithContext will inject the trace context in all the signature headers before publishing it -func (server *Server) SendChainWithContext(ctx context.Context, chain *tasks.Chain) (*result.ChainAsyncResult, error) { +func (server *Server) SendChainWithContext(ctx context.Context, chain *tasks.Chain, mainId string) (*result.ChainAsyncResult, error) { span, _ := opentracing.StartSpanFromContext(ctx, "SendChain", tracing.ProducerOption(), tracing.MachineryTag, tracing.WorkflowChainTag) defer span.Finish() tracing.AnnotateSpanWithChainInfo(span, chain) - return server.SendChain(chain) + return server.SendChain(chain, mainId) } // SendChain triggers a chain of tasks -func (server *Server) SendChain(chain *tasks.Chain) (*result.ChainAsyncResult, error) { +func (server *Server) SendChain(chain *tasks.Chain, mainId string) (*result.ChainAsyncResult, error) { _, err := server.SendTask(chain.Tasks[0]) if err != nil { return nil, err } + if server.backend == nil { + return nil, errors.New("Result backend required") + } + + server.backend.InitChain(chain.ChainUUId, chain.GetUUIDs(), mainId) + return result.NewChainAsyncResult(chain.Tasks, server.backend), nil } @@ -398,7 +404,7 @@ func (server *Server) RegisterPeriodicChain(spec, name string, signatures ...*ta } //send task - _, err = server.SendChain(chain) + _, err = server.SendChain(chain,"") if err != nil { log.ERROR.Printf("periodic task failed. task name is: %s. error is %s", name, err.Error()) } diff --git a/v1/server_test.go b/v1/server_test.go index cce786df3..df4c14a8c 100644 --- a/v1/server_test.go +++ b/v1/server_test.go @@ -5,8 +5,8 @@ import ( "github.com/stretchr/testify/assert" - "github.com/RichardKnop/machinery/v1" - "github.com/RichardKnop/machinery/v1/config" + "github.com/Michael-LiK/machinery/v1" + "github.com/Michael-LiK/machinery/v1/config" ) func TestRegisterTasks(t *testing.T) { diff --git a/v1/tasks/reflect_test.go b/v1/tasks/reflect_test.go index 8593666c5..75c8b5c29 100644 --- a/v1/tasks/reflect_test.go +++ b/v1/tasks/reflect_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/tasks" ) var ( diff --git a/v1/tasks/result_test.go b/v1/tasks/result_test.go index 5a4e879fe..911283625 100644 --- a/v1/tasks/result_test.go +++ b/v1/tasks/result_test.go @@ -3,7 +3,7 @@ package tasks_test import ( "testing" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v1/tasks/signature.go b/v1/tasks/signature.go index 7a90c4aad..fad3afc1f 100644 --- a/v1/tasks/signature.go +++ b/v1/tasks/signature.go @@ -2,7 +2,7 @@ package tasks import ( "fmt" - "github.com/RichardKnop/machinery/v1/utils" + "github.com/Michael-LiK/machinery/v1/utils" "time" "github.com/google/uuid" @@ -48,6 +48,9 @@ type Signature struct { Name string RoutingKey string ETA *time.Time + Index int + ChainUUID string + ChainTaskCount int GroupUUID string GroupTaskCount int Args []Arg diff --git a/v1/tasks/state.go b/v1/tasks/state.go index 8bd006b54..4d4b4edc7 100644 --- a/v1/tasks/state.go +++ b/v1/tasks/state.go @@ -40,6 +40,19 @@ type GroupMeta struct { TTL int64 `bson:"ttl,omitempty"` } +// ChainMeta stores useful metadata about tasks within the same group +// E.g. UUIDs of all tasks which are used in order to check if all tasks +// completed successfully or not and thus whether to trigger chord callback +type ChainMeta struct { + ChainUUID string `bson:"_id"` + MainId string `bson:"main_id"` + TaskUUIDs []string `bson:"task_uuids"` + ChordTriggered bool `bson:"chord_triggered"` + Lock bool `bson:"lock"` + CreatedAt time.Time `bson:"created_at"` + TTL int64 `bson:"ttl,omitempty"` +} + // NewPendingTaskState ... func NewPendingTaskState(signature *Signature) *TaskState { return &TaskState{ diff --git a/v1/tasks/state_test.go b/v1/tasks/state_test.go index 96619e896..8454e1715 100644 --- a/v1/tasks/state_test.go +++ b/v1/tasks/state_test.go @@ -3,7 +3,7 @@ package tasks_test import ( "testing" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v1/tasks/task.go b/v1/tasks/task.go index ca21a7a42..61c960f33 100644 --- a/v1/tasks/task.go +++ b/v1/tasks/task.go @@ -11,7 +11,7 @@ import ( opentracing_ext "github.com/opentracing/opentracing-go/ext" opentracing_log "github.com/opentracing/opentracing-go/log" - "github.com/RichardKnop/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/log" ) // ErrTaskPanicked ... diff --git a/v1/tasks/task_test.go b/v1/tasks/task_test.go index 1fde5ea77..3b7b115b0 100644 --- a/v1/tasks/task_test.go +++ b/v1/tasks/task_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v1/tasks/validate_test.go b/v1/tasks/validate_test.go index 4846d70af..076298351 100644 --- a/v1/tasks/validate_test.go +++ b/v1/tasks/validate_test.go @@ -3,7 +3,7 @@ package tasks_test import ( "testing" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v1/tasks/workflow.go b/v1/tasks/workflow.go index 38a786461..285c859f6 100644 --- a/v1/tasks/workflow.go +++ b/v1/tasks/workflow.go @@ -8,7 +8,8 @@ import ( // Chain creates a chain of tasks to be executed one after another type Chain struct { - Tasks []*Signature + ChainUUId string + Tasks []*Signature } // Group creates a set of tasks to be executed in parallel @@ -24,6 +25,15 @@ type Chord struct { Callback *Signature } +// GetUUIDs returns slice of task UUIDS +func (chain *Chain) GetUUIDs() []string { + taskUUIDs := make([]string, len(chain.Tasks)) + for i, signature := range chain.Tasks { + taskUUIDs[i] = signature.UUID + } + return taskUUIDs +} + // GetUUIDs returns slice of task UUIDS func (group *Group) GetUUIDs() []string { taskUUIDs := make([]string, len(group.Tasks)) @@ -37,11 +47,16 @@ func (group *Group) GetUUIDs() []string { // results unless task signatures are set to be immutable func NewChain(signatures ...*Signature) (*Chain, error) { // Auto generate task UUIDs if needed + chainUUID := uuid.New().String() + chainID := fmt.Sprintf("chain_%v", chainUUID) + for _, signature := range signatures { if signature.UUID == "" { signatureID := uuid.New().String() signature.UUID = fmt.Sprintf("task_%v", signatureID) } + signature.ChainUUID = chainID + signature.ChainTaskCount = len(signatures) } for i := len(signatures) - 1; i > 0; i-- { @@ -50,7 +65,7 @@ func NewChain(signatures ...*Signature) (*Chain, error) { } } - chain := &Chain{Tasks: signatures} + chain := &Chain{ChainUUId: chainID, Tasks: signatures} return chain, nil } diff --git a/v1/tasks/workflow_test.go b/v1/tasks/workflow_test.go index 5b7eacfe7..291075f4e 100644 --- a/v1/tasks/workflow_test.go +++ b/v1/tasks/workflow_test.go @@ -3,7 +3,7 @@ package tasks_test import ( "testing" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v1/tracing/tracing.go b/v1/tracing/tracing.go index ed5e83463..f4083cc58 100644 --- a/v1/tracing/tracing.go +++ b/v1/tracing/tracing.go @@ -3,7 +3,7 @@ package tracing import ( "encoding/json" - "github.com/RichardKnop/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/tasks" opentracing "github.com/opentracing/opentracing-go" opentracing_ext "github.com/opentracing/opentracing-go/ext" diff --git a/v1/worker.go b/v1/worker.go index ef6b10bd8..56040d5b8 100644 --- a/v1/worker.go +++ b/v1/worker.go @@ -12,12 +12,12 @@ import ( "github.com/opentracing/opentracing-go" - "github.com/RichardKnop/machinery/v1/backends/amqp" - "github.com/RichardKnop/machinery/v1/brokers/errs" - "github.com/RichardKnop/machinery/v1/log" - "github.com/RichardKnop/machinery/v1/retry" - "github.com/RichardKnop/machinery/v1/tasks" - "github.com/RichardKnop/machinery/v1/tracing" + "github.com/Michael-LiK/machinery/v1/backends/amqp" + "github.com/Michael-LiK/machinery/v1/brokers/errs" + "github.com/Michael-LiK/machinery/v1/log" + "github.com/Michael-LiK/machinery/v1/retry" + "github.com/Michael-LiK/machinery/v1/tasks" + "github.com/Michael-LiK/machinery/v1/tracing" ) // Worker represents a single worker process @@ -302,7 +302,7 @@ func (worker *Worker) taskSucceeded(signature *tasks.Signature, taskResults []*t // Defer purging of group meta queue if we are using AMQP backend if worker.hasAMQPBackend() { - defer worker.server.GetBackend().PurgeGroupMeta(signature.GroupUUID) + defer worker.server.GetBackend(). PurgeGroupMeta(signature.GroupUUID) } // Trigger chord callback diff --git a/v1/worker_test.go b/v1/worker_test.go index 1a02084ba..51b55e078 100644 --- a/v1/worker_test.go +++ b/v1/worker_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/RichardKnop/machinery/v1" + "github.com/Michael-LiK/machinery/v1" ) func TestRedactURL(t *testing.T) { diff --git a/v2/backends/amqp/amqp.go b/v2/backends/amqp/amqp.go index c9103bf2e..e637c80a4 100644 --- a/v2/backends/amqp/amqp.go +++ b/v2/backends/amqp/amqp.go @@ -20,11 +20,11 @@ import ( "errors" "fmt" - "github.com/RichardKnop/machinery/v2/backends/iface" - "github.com/RichardKnop/machinery/v2/common" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/backends/iface" + "github.com/Michael-LiK/machinery/v2/common" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/streadway/amqp" ) diff --git a/v2/backends/amqp/amqp_test.go b/v2/backends/amqp/amqp_test.go index 1a84c3b13..fcbdf4d83 100644 --- a/v2/backends/amqp/amqp_test.go +++ b/v2/backends/amqp/amqp_test.go @@ -5,9 +5,9 @@ import ( "testing" "time" - "github.com/RichardKnop/machinery/v2/backends/amqp" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/backends/amqp" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v2/backends/dynamodb/dynamodb.go b/v2/backends/dynamodb/dynamodb.go index 9401cb6b7..f306b61c0 100644 --- a/v2/backends/dynamodb/dynamodb.go +++ b/v2/backends/dynamodb/dynamodb.go @@ -8,11 +8,11 @@ import ( "github.com/aws/aws-sdk-go/aws/session" - "github.com/RichardKnop/machinery/v2/backends/iface" - "github.com/RichardKnop/machinery/v2/common" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/backends/iface" + "github.com/Michael-LiK/machinery/v2/common" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute" diff --git a/v2/backends/dynamodb/dynamodb_export_test.go b/v2/backends/dynamodb/dynamodb_export_test.go index 9508a763b..b419a4655 100644 --- a/v2/backends/dynamodb/dynamodb_export_test.go +++ b/v2/backends/dynamodb/dynamodb_export_test.go @@ -4,8 +4,8 @@ import ( "errors" "os" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface" diff --git a/v2/backends/dynamodb/dynamodb_test.go b/v2/backends/dynamodb/dynamodb_test.go index 1772fe455..1fe36cb59 100644 --- a/v2/backends/dynamodb/dynamodb_test.go +++ b/v2/backends/dynamodb/dynamodb_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - "github.com/RichardKnop/machinery/v2/backends/dynamodb" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/backends/dynamodb" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/aws/aws-sdk-go/aws" "github.com/stretchr/testify/assert" diff --git a/v2/backends/eager/eager.go b/v2/backends/eager/eager.go index 292b63b73..9ecbf5add 100644 --- a/v2/backends/eager/eager.go +++ b/v2/backends/eager/eager.go @@ -6,10 +6,10 @@ import ( "fmt" "sync" - "github.com/RichardKnop/machinery/v2/backends/iface" - "github.com/RichardKnop/machinery/v2/common" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/backends/iface" + "github.com/Michael-LiK/machinery/v2/common" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/tasks" ) // ErrGroupNotFound ... diff --git a/v2/backends/eager/eager_test.go b/v2/backends/eager/eager_test.go index 11c696005..dd25103ff 100644 --- a/v2/backends/eager/eager_test.go +++ b/v2/backends/eager/eager_test.go @@ -4,9 +4,9 @@ import ( "encoding/json" "testing" - "github.com/RichardKnop/machinery/v2/backends/eager" - "github.com/RichardKnop/machinery/v2/backends/iface" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/backends/eager" + "github.com/Michael-LiK/machinery/v2/backends/iface" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/stretchr/testify/suite" ) diff --git a/v2/backends/iface/interfaces.go b/v2/backends/iface/interfaces.go index f1432ae6a..305180620 100644 --- a/v2/backends/iface/interfaces.go +++ b/v2/backends/iface/interfaces.go @@ -1,7 +1,7 @@ package iface import ( - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/tasks" ) // Backend - a common interface for all result backends diff --git a/v2/backends/memcache/memcache.go b/v2/backends/memcache/memcache.go index 1f6ae65a9..0676d8a69 100644 --- a/v2/backends/memcache/memcache.go +++ b/v2/backends/memcache/memcache.go @@ -5,11 +5,11 @@ import ( "encoding/json" "time" - "github.com/RichardKnop/machinery/v2/backends/iface" - "github.com/RichardKnop/machinery/v2/common" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/backends/iface" + "github.com/Michael-LiK/machinery/v2/common" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/tasks" gomemcache "github.com/bradfitz/gomemcache/memcache" ) diff --git a/v2/backends/memcache/memcache_test.go b/v2/backends/memcache/memcache_test.go index 1486a9642..34a8c1e64 100644 --- a/v2/backends/memcache/memcache_test.go +++ b/v2/backends/memcache/memcache_test.go @@ -5,9 +5,9 @@ import ( "testing" "time" - "github.com/RichardKnop/machinery/v2/backends/memcache" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/backends/memcache" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v2/backends/mongo/mongodb.go b/v2/backends/mongo/mongodb.go index 63fcaf304..0d00b32bb 100644 --- a/v2/backends/mongo/mongodb.go +++ b/v2/backends/mongo/mongodb.go @@ -13,11 +13,11 @@ import ( "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" - "github.com/RichardKnop/machinery/v2/backends/iface" - "github.com/RichardKnop/machinery/v2/common" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/backends/iface" + "github.com/Michael-LiK/machinery/v2/common" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/tasks" ) // Backend represents a MongoDB result backend diff --git a/v2/backends/mongo/mongodb_test.go b/v2/backends/mongo/mongodb_test.go index e3b165596..229dabb54 100644 --- a/v2/backends/mongo/mongodb_test.go +++ b/v2/backends/mongo/mongodb_test.go @@ -4,10 +4,10 @@ import ( "os" "testing" - "github.com/RichardKnop/machinery/v2/backends/iface" - "github.com/RichardKnop/machinery/v2/backends/mongo" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/backends/iface" + "github.com/Michael-LiK/machinery/v2/backends/mongo" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v2/backends/null/null.go b/v2/backends/null/null.go index 87d6b1610..3637ec7a2 100644 --- a/v2/backends/null/null.go +++ b/v2/backends/null/null.go @@ -3,10 +3,10 @@ package null import ( "fmt" - "github.com/RichardKnop/machinery/v2/backends/iface" - "github.com/RichardKnop/machinery/v2/common" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/backends/iface" + "github.com/Michael-LiK/machinery/v2/common" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/tasks" ) // ErrGroupNotFound ... diff --git a/v2/backends/redis/goredis.go b/v2/backends/redis/goredis.go index 2045eecb8..5293f74c5 100644 --- a/v2/backends/redis/goredis.go +++ b/v2/backends/redis/goredis.go @@ -12,11 +12,11 @@ import ( "github.com/go-redsync/redsync/v4" redsyncgoredis "github.com/go-redsync/redsync/v4/redis/goredis/v8" - "github.com/RichardKnop/machinery/v2/backends/iface" - "github.com/RichardKnop/machinery/v2/common" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/backends/iface" + "github.com/Michael-LiK/machinery/v2/common" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/tasks" ) // BackendGR represents a Redis result backend diff --git a/v2/backends/redis/goredis_test.go b/v2/backends/redis/goredis_test.go index 894e9a43b..48b58419f 100644 --- a/v2/backends/redis/goredis_test.go +++ b/v2/backends/redis/goredis_test.go @@ -1,14 +1,14 @@ package redis_test import ( - "github.com/RichardKnop/machinery/v2/backends/iface" + "github.com/Michael-LiK/machinery/v2/backends/iface" "os" "strings" "testing" - "github.com/RichardKnop/machinery/v2/backends/redis" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/backends/redis" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v2/backends/redis/redis.go b/v2/backends/redis/redis.go index 72bf75518..12e47398b 100644 --- a/v2/backends/redis/redis.go +++ b/v2/backends/redis/redis.go @@ -11,11 +11,11 @@ import ( redsyncredis "github.com/go-redsync/redsync/v4/redis/redigo" "github.com/gomodule/redigo/redis" - "github.com/RichardKnop/machinery/v2/backends/iface" - "github.com/RichardKnop/machinery/v2/common" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/backends/iface" + "github.com/Michael-LiK/machinery/v2/common" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/tasks" ) // Backend represents a Redis result backend diff --git a/v2/backends/redis/redis_test.go b/v2/backends/redis/redis_test.go index 7493b1bbd..2a6b38938 100644 --- a/v2/backends/redis/redis_test.go +++ b/v2/backends/redis/redis_test.go @@ -4,9 +4,9 @@ import ( "os" "testing" - "github.com/RichardKnop/machinery/v2/backends/redis" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/backends/redis" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v2/backends/result/async_result.go b/v2/backends/result/async_result.go index 7eaaf1371..6309d8c16 100644 --- a/v2/backends/result/async_result.go +++ b/v2/backends/result/async_result.go @@ -5,8 +5,8 @@ import ( "reflect" "time" - "github.com/RichardKnop/machinery/v2/backends/iface" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/backends/iface" + "github.com/Michael-LiK/machinery/v2/tasks" ) var ( diff --git a/v2/brokers/amqp/amqp.go b/v2/brokers/amqp/amqp.go index b26229ca8..0aa64254b 100644 --- a/v2/brokers/amqp/amqp.go +++ b/v2/brokers/amqp/amqp.go @@ -8,12 +8,12 @@ import ( "sync" "time" - "github.com/RichardKnop/machinery/v2/brokers/errs" - "github.com/RichardKnop/machinery/v2/brokers/iface" - "github.com/RichardKnop/machinery/v2/common" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/brokers/errs" + "github.com/Michael-LiK/machinery/v2/brokers/iface" + "github.com/Michael-LiK/machinery/v2/common" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/pkg/errors" "github.com/streadway/amqp" ) diff --git a/v2/brokers/amqp/amqp_concurrence_test.go b/v2/brokers/amqp/amqp_concurrence_test.go index 67c44fd1e..d36a4739f 100644 --- a/v2/brokers/amqp/amqp_concurrence_test.go +++ b/v2/brokers/amqp/amqp_concurrence_test.go @@ -2,9 +2,9 @@ package amqp import ( "fmt" - "github.com/RichardKnop/machinery/v2/brokers/iface" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/brokers/iface" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/streadway/amqp" "testing" "time" diff --git a/v2/brokers/amqp/amqp_test.go b/v2/brokers/amqp/amqp_test.go index 8b4b48011..40f650700 100644 --- a/v2/brokers/amqp/amqp_test.go +++ b/v2/brokers/amqp/amqp_test.go @@ -3,10 +3,10 @@ package amqp_test import ( "testing" - "github.com/RichardKnop/machinery/v2/brokers/amqp" - "github.com/RichardKnop/machinery/v2/brokers/iface" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/brokers/amqp" + "github.com/Michael-LiK/machinery/v2/brokers/iface" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v2/brokers/eager/eager.go b/v2/brokers/eager/eager.go index 49a6bcbf7..e18f801ad 100644 --- a/v2/brokers/eager/eager.go +++ b/v2/brokers/eager/eager.go @@ -7,9 +7,9 @@ import ( "errors" "fmt" - "github.com/RichardKnop/machinery/v2/brokers/iface" - "github.com/RichardKnop/machinery/v2/common" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/brokers/iface" + "github.com/Michael-LiK/machinery/v2/common" + "github.com/Michael-LiK/machinery/v2/tasks" ) // Broker represents an "eager" in-memory broker diff --git a/v2/brokers/gcppubsub/gcp_pubsub.go b/v2/brokers/gcppubsub/gcp_pubsub.go index a10e68ecc..072ac72db 100644 --- a/v2/brokers/gcppubsub/gcp_pubsub.go +++ b/v2/brokers/gcppubsub/gcp_pubsub.go @@ -8,11 +8,11 @@ import ( "time" "cloud.google.com/go/pubsub" - "github.com/RichardKnop/machinery/v2/brokers/iface" - "github.com/RichardKnop/machinery/v2/common" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/brokers/iface" + "github.com/Michael-LiK/machinery/v2/common" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/tasks" ) // Broker represents an Google Cloud Pub/Sub broker diff --git a/v2/brokers/iface/interfaces.go b/v2/brokers/iface/interfaces.go index 95fafbb5e..5c922f9a4 100644 --- a/v2/brokers/iface/interfaces.go +++ b/v2/brokers/iface/interfaces.go @@ -3,8 +3,8 @@ package iface import ( "context" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/tasks" ) // Broker - a common interface for all brokers diff --git a/v2/brokers/redis/goredis.go b/v2/brokers/redis/goredis.go index 82b5347cb..3fd09b14a 100644 --- a/v2/brokers/redis/goredis.go +++ b/v2/brokers/redis/goredis.go @@ -14,12 +14,12 @@ import ( "github.com/go-redis/redis/v8" "github.com/go-redsync/redsync/v4" - "github.com/RichardKnop/machinery/v2/brokers/errs" - "github.com/RichardKnop/machinery/v2/brokers/iface" - "github.com/RichardKnop/machinery/v2/common" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/brokers/errs" + "github.com/Michael-LiK/machinery/v2/brokers/iface" + "github.com/Michael-LiK/machinery/v2/common" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/tasks" ) // BrokerGR represents a Redis broker diff --git a/v2/brokers/redis/redis.go b/v2/brokers/redis/redis.go index eeb3ca78e..cb51cf9c0 100644 --- a/v2/brokers/redis/redis.go +++ b/v2/brokers/redis/redis.go @@ -14,12 +14,12 @@ import ( redsyncredis "github.com/go-redsync/redsync/v4/redis/redigo" "github.com/gomodule/redigo/redis" - "github.com/RichardKnop/machinery/v2/brokers/errs" - "github.com/RichardKnop/machinery/v2/brokers/iface" - "github.com/RichardKnop/machinery/v2/common" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/brokers/errs" + "github.com/Michael-LiK/machinery/v2/brokers/iface" + "github.com/Michael-LiK/machinery/v2/common" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/tasks" ) const defaultRedisDelayedTasksKey = "delayed_tasks" diff --git a/v2/brokers/sqs/sqs.go b/v2/brokers/sqs/sqs.go index b8cdb0457..5c239a4e4 100644 --- a/v2/brokers/sqs/sqs.go +++ b/v2/brokers/sqs/sqs.go @@ -9,12 +9,12 @@ import ( "sync" "time" - "github.com/RichardKnop/machinery/v2/brokers/errs" - "github.com/RichardKnop/machinery/v2/brokers/iface" - "github.com/RichardKnop/machinery/v2/common" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/brokers/errs" + "github.com/Michael-LiK/machinery/v2/brokers/iface" + "github.com/Michael-LiK/machinery/v2/common" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sqs/sqsiface" diff --git a/v2/brokers/sqs/sqs_export_test.go b/v2/brokers/sqs/sqs_export_test.go index 8bcd8d626..b008e76e0 100644 --- a/v2/brokers/sqs/sqs_export_test.go +++ b/v2/brokers/sqs/sqs_export_test.go @@ -11,9 +11,9 @@ import ( "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/sqs/sqsiface" - "github.com/RichardKnop/machinery/v2/brokers/iface" - "github.com/RichardKnop/machinery/v2/common" - "github.com/RichardKnop/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/brokers/iface" + "github.com/Michael-LiK/machinery/v2/common" + "github.com/Michael-LiK/machinery/v2/config" awssqs "github.com/aws/aws-sdk-go/service/sqs" ) diff --git a/v2/brokers/sqs/sqs_test.go b/v2/brokers/sqs/sqs_test.go index 797c5de28..2d6f1dff1 100644 --- a/v2/brokers/sqs/sqs_test.go +++ b/v2/brokers/sqs/sqs_test.go @@ -10,10 +10,10 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/stretchr/testify/assert" - "github.com/RichardKnop/machinery/v2" - "github.com/RichardKnop/machinery/v2/brokers/sqs" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/retry" + "github.com/Michael-LiK/machinery/v2" + "github.com/Michael-LiK/machinery/v2/brokers/sqs" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/retry" awssqs "github.com/aws/aws-sdk-go/service/sqs" ) diff --git a/v2/common/backend.go b/v2/common/backend.go index 3ab094a75..5c59aaeb7 100644 --- a/v2/common/backend.go +++ b/v2/common/backend.go @@ -1,7 +1,7 @@ package common import ( - "github.com/RichardKnop/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/config" ) // Backend represents a base backend structure diff --git a/v2/common/broker.go b/v2/common/broker.go index d139ab559..142d33a3e 100644 --- a/v2/common/broker.go +++ b/v2/common/broker.go @@ -4,11 +4,11 @@ import ( "errors" "sync" - "github.com/RichardKnop/machinery/v2/brokers/iface" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/retry" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/brokers/iface" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/retry" + "github.com/Michael-LiK/machinery/v2/tasks" ) type registeredTaskNames struct { diff --git a/v2/common/broker_test.go b/v2/common/broker_test.go index 78f6c1da2..ffe6cf2fd 100644 --- a/v2/common/broker_test.go +++ b/v2/common/broker_test.go @@ -3,10 +3,10 @@ package common_test import ( "testing" - "github.com/RichardKnop/machinery/v2" - "github.com/RichardKnop/machinery/v2/common" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2" + "github.com/Michael-LiK/machinery/v2/common" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v2/common/redis.go b/v2/common/redis.go index 6aa7494dc..e8fea55da 100644 --- a/v2/common/redis.go +++ b/v2/common/redis.go @@ -6,7 +6,7 @@ import ( "github.com/gomodule/redigo/redis" - "github.com/RichardKnop/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/config" ) var ( diff --git a/v2/config/env.go b/v2/config/env.go index a0c935bdd..3d717d8aa 100644 --- a/v2/config/env.go +++ b/v2/config/env.go @@ -3,7 +3,7 @@ package config import ( "github.com/kelseyhightower/envconfig" - "github.com/RichardKnop/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/log" ) // NewFromEnvironment creates a config object from environment variables diff --git a/v2/config/env_test.go b/v2/config/env_test.go index 799e8f2b4..770eb42d6 100644 --- a/v2/config/env_test.go +++ b/v2/config/env_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/RichardKnop/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/config" "github.com/stretchr/testify/assert" ) diff --git a/v2/config/file.go b/v2/config/file.go index acc190348..cf759bed8 100644 --- a/v2/config/file.go +++ b/v2/config/file.go @@ -5,7 +5,7 @@ import ( "os" "time" - "github.com/RichardKnop/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/log" "gopkg.in/yaml.v2" ) diff --git a/v2/config/file_test.go b/v2/config/file_test.go index 8922e3b83..f0045b0e6 100644 --- a/v2/config/file_test.go +++ b/v2/config/file_test.go @@ -3,7 +3,7 @@ package config_test import ( "testing" - "github.com/RichardKnop/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/config" "github.com/stretchr/testify/assert" ) diff --git a/v2/example/amqp/main.go b/v2/example/amqp/main.go index 4f9e8b7d0..7d7956ad7 100644 --- a/v2/example/amqp/main.go +++ b/v2/example/amqp/main.go @@ -10,16 +10,16 @@ import ( "github.com/google/uuid" "github.com/urfave/cli" - "github.com/RichardKnop/machinery/v2" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/tasks" - - amqpbackend "github.com/RichardKnop/machinery/v2/backends/amqp" - amqpbroker "github.com/RichardKnop/machinery/v2/brokers/amqp" - exampletasks "github.com/RichardKnop/machinery/v2/example/tasks" - "github.com/RichardKnop/machinery/v2/example/tracers" - eagerlock "github.com/RichardKnop/machinery/v2/locks/eager" + "github.com/Michael-LiK/machinery/v2" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/tasks" + + amqpbackend "github.com/Michael-LiK/machinery/v2/backends/amqp" + amqpbroker "github.com/Michael-LiK/machinery/v2/brokers/amqp" + exampletasks "github.com/Michael-LiK/machinery/v2/example/tasks" + "github.com/Michael-LiK/machinery/v2/example/tracers" + eagerlock "github.com/Michael-LiK/machinery/v2/locks/eager" "github.com/opentracing/opentracing-go" opentracinglog "github.com/opentracing/opentracing-go/log" ) diff --git a/v2/example/go-redis/main.go b/v2/example/go-redis/main.go index 1e251f63d..8ab74983e 100644 --- a/v2/example/go-redis/main.go +++ b/v2/example/go-redis/main.go @@ -10,16 +10,16 @@ import ( "github.com/google/uuid" "github.com/urfave/cli" - "github.com/RichardKnop/machinery/v2" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/tasks" - - redisbackend "github.com/RichardKnop/machinery/v2/backends/redis" - redisbroker "github.com/RichardKnop/machinery/v2/brokers/redis" - exampletasks "github.com/RichardKnop/machinery/v2/example/tasks" - "github.com/RichardKnop/machinery/v2/example/tracers" - eagerlock "github.com/RichardKnop/machinery/v2/locks/eager" + "github.com/Michael-LiK/machinery/v2" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/tasks" + + redisbackend "github.com/Michael-LiK/machinery/v2/backends/redis" + redisbroker "github.com/Michael-LiK/machinery/v2/brokers/redis" + exampletasks "github.com/Michael-LiK/machinery/v2/example/tasks" + "github.com/Michael-LiK/machinery/v2/example/tracers" + eagerlock "github.com/Michael-LiK/machinery/v2/locks/eager" "github.com/opentracing/opentracing-go" opentracinglog "github.com/opentracing/opentracing-go/log" ) diff --git a/v2/example/redigo/main.go b/v2/example/redigo/main.go index 3e89cde7a..f7cce1448 100644 --- a/v2/example/redigo/main.go +++ b/v2/example/redigo/main.go @@ -10,16 +10,16 @@ import ( "github.com/google/uuid" "github.com/urfave/cli" - "github.com/RichardKnop/machinery/v2" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/tasks" - - redisbackend "github.com/RichardKnop/machinery/v2/backends/redis" - redisbroker "github.com/RichardKnop/machinery/v2/brokers/redis" - exampletasks "github.com/RichardKnop/machinery/v2/example/tasks" - "github.com/RichardKnop/machinery/v2/example/tracers" - eagerlock "github.com/RichardKnop/machinery/v2/locks/eager" + "github.com/Michael-LiK/machinery/v2" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/tasks" + + redisbackend "github.com/Michael-LiK/machinery/v2/backends/redis" + redisbroker "github.com/Michael-LiK/machinery/v2/brokers/redis" + exampletasks "github.com/Michael-LiK/machinery/v2/example/tasks" + "github.com/Michael-LiK/machinery/v2/example/tracers" + eagerlock "github.com/Michael-LiK/machinery/v2/locks/eager" "github.com/opentracing/opentracing-go" opentracinglog "github.com/opentracing/opentracing-go/log" ) diff --git a/v2/example/tasks/tasks.go b/v2/example/tasks/tasks.go index 750b82635..358ca4feb 100644 --- a/v2/example/tasks/tasks.go +++ b/v2/example/tasks/tasks.go @@ -5,7 +5,7 @@ import ( "strings" "time" - "github.com/RichardKnop/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/log" ) // Add ... diff --git a/v2/go.mod b/v2/go.mod index 929eed489..cfaf33494 100644 --- a/v2/go.mod +++ b/v2/go.mod @@ -1,10 +1,10 @@ -module github.com/RichardKnop/machinery/v2 +module github.com/Michael-LiK/machinery/v2 go 1.15 require ( cloud.google.com/go/pubsub v1.10.0 - github.com/RichardKnop/logging v0.0.0-20190827224416-1a693bdd4fae + github.com/Michael-LiK/logging v0.0.0-20190827224416-1a693bdd4fae github.com/aws/aws-sdk-go v1.37.16 github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b github.com/go-redis/redis/v8 v8.6.0 diff --git a/v2/go.sum b/v2/go.sum index 964466abe..285e5801e 100644 --- a/v2/go.sum +++ b/v2/go.sum @@ -37,8 +37,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/RichardKnop/logging v0.0.0-20190827224416-1a693bdd4fae h1:DcFpTQBYQ9Ct2d6sC7ol0/ynxc2pO1cpGUM+f4t5adg= -github.com/RichardKnop/logging v0.0.0-20190827224416-1a693bdd4fae/go.mod h1:rJJ84PyA/Wlmw1hO+xTzV2wsSUon6J5ktg0g8BF2PuU= +github.com/Michael-LiK/logging v0.0.0-20190827224416-1a693bdd4fae h1:DcFpTQBYQ9Ct2d6sC7ol0/ynxc2pO1cpGUM+f4t5adg= +github.com/Michael-LiK/logging v0.0.0-20190827224416-1a693bdd4fae/go.mod h1:rJJ84PyA/Wlmw1hO+xTzV2wsSUon6J5ktg0g8BF2PuU= github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= github.com/aws/aws-sdk-go v1.37.16/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= diff --git a/v2/integration-tests/amqp_amqp_test.go b/v2/integration-tests/amqp_amqp_test.go index 4c8491627..6f711e552 100644 --- a/v2/integration-tests/amqp_amqp_test.go +++ b/v2/integration-tests/amqp_amqp_test.go @@ -4,12 +4,12 @@ import ( "os" "testing" - "github.com/RichardKnop/machinery/v2" - "github.com/RichardKnop/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2" + "github.com/Michael-LiK/machinery/v2/config" - amqpbackend "github.com/RichardKnop/machinery/v2/backends/amqp" - amqpbroker "github.com/RichardKnop/machinery/v2/brokers/amqp" - eagerlock "github.com/RichardKnop/machinery/v2/locks/eager" + amqpbackend "github.com/Michael-LiK/machinery/v2/backends/amqp" + amqpbroker "github.com/Michael-LiK/machinery/v2/brokers/amqp" + eagerlock "github.com/Michael-LiK/machinery/v2/locks/eager" ) func TestAmqpAmqp(t *testing.T) { diff --git a/v2/integration-tests/redis_redis_test.go b/v2/integration-tests/redis_redis_test.go index e9fd8b9d5..b3cf1e2d8 100644 --- a/v2/integration-tests/redis_redis_test.go +++ b/v2/integration-tests/redis_redis_test.go @@ -4,11 +4,11 @@ import ( "os" "testing" - "github.com/RichardKnop/machinery/v2" - redisbackend "github.com/RichardKnop/machinery/v2/backends/redis" - redisbroker "github.com/RichardKnop/machinery/v2/brokers/redis" - "github.com/RichardKnop/machinery/v2/config" - eagerlock "github.com/RichardKnop/machinery/v2/locks/eager" + "github.com/Michael-LiK/machinery/v2" + redisbackend "github.com/Michael-LiK/machinery/v2/backends/redis" + redisbroker "github.com/Michael-LiK/machinery/v2/brokers/redis" + "github.com/Michael-LiK/machinery/v2/config" + eagerlock "github.com/Michael-LiK/machinery/v2/locks/eager" ) func TestRedisRedis_GoRedis(t *testing.T) { diff --git a/v2/integration-tests/suite_test.go b/v2/integration-tests/suite_test.go index 3857771e5..c08436471 100644 --- a/v2/integration-tests/suite_test.go +++ b/v2/integration-tests/suite_test.go @@ -10,11 +10,11 @@ import ( "github.com/stretchr/testify/assert" - "github.com/RichardKnop/machinery/v2/backends/result" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/backends/result" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/tasks" - brokersiface "github.com/RichardKnop/machinery/v2/brokers/iface" + brokersiface "github.com/Michael-LiK/machinery/v2/brokers/iface" ) type ascendingInt64s []int64 diff --git a/v2/locks/eager/eager_test.go b/v2/locks/eager/eager_test.go index bdc60d348..63ebb264b 100644 --- a/v2/locks/eager/eager_test.go +++ b/v2/locks/eager/eager_test.go @@ -1,8 +1,8 @@ package eager import ( - lockiface "github.com/RichardKnop/machinery/v2/locks/iface" - "github.com/RichardKnop/machinery/v2/utils" + lockiface "github.com/Michael-LiK/machinery/v2/locks/iface" + "github.com/Michael-LiK/machinery/v2/utils" "github.com/stretchr/testify/assert" "testing" "time" diff --git a/v2/locks/redis/redis.go b/v2/locks/redis/redis.go index 5bb159b4f..6fbc090c0 100644 --- a/v2/locks/redis/redis.go +++ b/v2/locks/redis/redis.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/RichardKnop/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/config" "github.com/go-redis/redis/v8" ) diff --git a/v2/log/log.go b/v2/log/log.go index 12f382c61..6c7d8a490 100644 --- a/v2/log/log.go +++ b/v2/log/log.go @@ -1,7 +1,7 @@ package log import ( - "github.com/RichardKnop/logging" + "github.com/Michael-LiK/logging" ) var ( diff --git a/v2/log/log_test.go b/v2/log/log_test.go index 1e381ac8b..394ecac4b 100644 --- a/v2/log/log_test.go +++ b/v2/log/log_test.go @@ -3,7 +3,7 @@ package log_test import ( "testing" - "github.com/RichardKnop/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/log" ) func TestDefaultLogger(t *testing.T) { diff --git a/v2/retry/fibonacci_test.go b/v2/retry/fibonacci_test.go index ea46730ab..0e267fd1e 100644 --- a/v2/retry/fibonacci_test.go +++ b/v2/retry/fibonacci_test.go @@ -3,7 +3,7 @@ package retry_test import ( "testing" - "github.com/RichardKnop/machinery/v2/retry" + "github.com/Michael-LiK/machinery/v2/retry" "github.com/stretchr/testify/assert" ) diff --git a/v2/retry/retry.go b/v2/retry/retry.go index 94b1e0b68..9039afb02 100644 --- a/v2/retry/retry.go +++ b/v2/retry/retry.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/RichardKnop/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/log" ) // Closure - a useful closure we can use when there is a problem diff --git a/v2/server.go b/v2/server.go index db3cb58f9..8321e1363 100644 --- a/v2/server.go +++ b/v2/server.go @@ -10,16 +10,16 @@ import ( "github.com/google/uuid" "github.com/robfig/cron/v3" - "github.com/RichardKnop/machinery/v2/backends/result" - "github.com/RichardKnop/machinery/v2/config" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/tasks" - "github.com/RichardKnop/machinery/v2/tracing" - "github.com/RichardKnop/machinery/v2/utils" - - backendsiface "github.com/RichardKnop/machinery/v2/backends/iface" - brokersiface "github.com/RichardKnop/machinery/v2/brokers/iface" - lockiface "github.com/RichardKnop/machinery/v2/locks/iface" + "github.com/Michael-LiK/machinery/v2/backends/result" + "github.com/Michael-LiK/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/tracing" + "github.com/Michael-LiK/machinery/v2/utils" + + backendsiface "github.com/Michael-LiK/machinery/v2/backends/iface" + brokersiface "github.com/Michael-LiK/machinery/v2/brokers/iface" + lockiface "github.com/Michael-LiK/machinery/v2/locks/iface" opentracing "github.com/opentracing/opentracing-go" ) diff --git a/v2/server_test.go b/v2/server_test.go index 4f1966f08..eff379e79 100644 --- a/v2/server_test.go +++ b/v2/server_test.go @@ -5,12 +5,12 @@ import ( "github.com/stretchr/testify/assert" - "github.com/RichardKnop/machinery/v2" - "github.com/RichardKnop/machinery/v2/config" + "github.com/Michael-LiK/machinery/v2" + "github.com/Michael-LiK/machinery/v2/config" - backend "github.com/RichardKnop/machinery/v2/backends/eager" - broker "github.com/RichardKnop/machinery/v2/brokers/eager" - lock "github.com/RichardKnop/machinery/v2/locks/eager" + backend "github.com/Michael-LiK/machinery/v2/backends/eager" + broker "github.com/Michael-LiK/machinery/v2/brokers/eager" + lock "github.com/Michael-LiK/machinery/v2/locks/eager" ) func TestRegisterTasks(t *testing.T) { diff --git a/v2/tasks/reflect_test.go b/v2/tasks/reflect_test.go index 3fe9e692d..76b66eb97 100644 --- a/v2/tasks/reflect_test.go +++ b/v2/tasks/reflect_test.go @@ -5,7 +5,7 @@ import ( "reflect" "testing" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/tasks" ) var ( diff --git a/v2/tasks/result_test.go b/v2/tasks/result_test.go index 5d2466368..52326a59d 100644 --- a/v2/tasks/result_test.go +++ b/v2/tasks/result_test.go @@ -3,7 +3,7 @@ package tasks_test import ( "testing" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v2/tasks/signature.go b/v2/tasks/signature.go index f639391dd..7b6d86d2d 100644 --- a/v2/tasks/signature.go +++ b/v2/tasks/signature.go @@ -2,7 +2,7 @@ package tasks import ( "fmt" - "github.com/RichardKnop/machinery/v2/utils" + "github.com/Michael-LiK/machinery/v2/utils" "time" "github.com/google/uuid" diff --git a/v2/tasks/state_test.go b/v2/tasks/state_test.go index 9ed0a1d91..ed37952c7 100644 --- a/v2/tasks/state_test.go +++ b/v2/tasks/state_test.go @@ -3,7 +3,7 @@ package tasks_test import ( "testing" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v2/tasks/task.go b/v2/tasks/task.go index c2342fabd..057b59a4f 100644 --- a/v2/tasks/task.go +++ b/v2/tasks/task.go @@ -11,7 +11,7 @@ import ( opentracing_ext "github.com/opentracing/opentracing-go/ext" opentracing_log "github.com/opentracing/opentracing-go/log" - "github.com/RichardKnop/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/log" ) // ErrTaskPanicked ... diff --git a/v2/tasks/task_test.go b/v2/tasks/task_test.go index 525f2aaec..34e3a1756 100644 --- a/v2/tasks/task_test.go +++ b/v2/tasks/task_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v2/tasks/validate_test.go b/v2/tasks/validate_test.go index c47a227ac..c15cee269 100644 --- a/v2/tasks/validate_test.go +++ b/v2/tasks/validate_test.go @@ -3,7 +3,7 @@ package tasks_test import ( "testing" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v2/tasks/workflow_test.go b/v2/tasks/workflow_test.go index 12bb3fd1b..e76dab175 100644 --- a/v2/tasks/workflow_test.go +++ b/v2/tasks/workflow_test.go @@ -3,7 +3,7 @@ package tasks_test import ( "testing" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/tasks" "github.com/stretchr/testify/assert" ) diff --git a/v2/tracing/tracing.go b/v2/tracing/tracing.go index 3f7c59bb1..36351b1da 100644 --- a/v2/tracing/tracing.go +++ b/v2/tracing/tracing.go @@ -3,7 +3,7 @@ package tracing import ( "encoding/json" - "github.com/RichardKnop/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/tasks" opentracing "github.com/opentracing/opentracing-go" opentracing_ext "github.com/opentracing/opentracing-go/ext" diff --git a/v2/worker.go b/v2/worker.go index ccfc96602..26e6a9f72 100644 --- a/v2/worker.go +++ b/v2/worker.go @@ -12,12 +12,12 @@ import ( "github.com/opentracing/opentracing-go" - "github.com/RichardKnop/machinery/v2/backends/amqp" - "github.com/RichardKnop/machinery/v2/brokers/errs" - "github.com/RichardKnop/machinery/v2/log" - "github.com/RichardKnop/machinery/v2/retry" - "github.com/RichardKnop/machinery/v2/tasks" - "github.com/RichardKnop/machinery/v2/tracing" + "github.com/Michael-LiK/machinery/v2/backends/amqp" + "github.com/Michael-LiK/machinery/v2/brokers/errs" + "github.com/Michael-LiK/machinery/v2/log" + "github.com/Michael-LiK/machinery/v2/retry" + "github.com/Michael-LiK/machinery/v2/tasks" + "github.com/Michael-LiK/machinery/v2/tracing" ) // Worker represents a single worker process diff --git a/v2/worker_test.go b/v2/worker_test.go index 5f869da97..d5950faeb 100644 --- a/v2/worker_test.go +++ b/v2/worker_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/RichardKnop/machinery/v2" + "github.com/Michael-LiK/machinery/v2" ) func TestRedactURL(t *testing.T) {