Skip to content

Commit

Permalink
big v2 refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardKnop committed Feb 23, 2021
1 parent 9dde0e4 commit c7fb8ad
Show file tree
Hide file tree
Showing 93 changed files with 12,364 additions and 145 deletions.
File renamed without changes.
File renamed without changes.
10 changes: 3 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
module github.com/RichardKnop/machinery

go 1.15

require (
cloud.google.com/go v0.76.0 // indirect
cloud.google.com/go/pubsub v1.9.1
github.com/RichardKnop/logging v0.0.0-20190827224416-1a693bdd4fae
github.com/RichardKnop/machinery/v2 v2.0.4 // indirect
github.com/aws/aws-sdk-go v1.37.5
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/go-redis/redis/v8 v8.5.0
github.com/go-redsync/redsync/v4 v4.0.4
github.com/golang/snappy v0.0.2 // indirect
github.com/gomodule/redigo v2.0.0+incompatible
github.com/google/uuid v1.2.0
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/kelseyhightower/envconfig v1.4.0
github.com/klauspost/compress v1.11.7 // indirect
github.com/opentracing/opentracing-go v1.2.0
github.com/pkg/errors v0.9.1
github.com/robfig/cron/v3 v3.0.1
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/streadway/amqp v1.0.0
github.com/stretchr/testify v1.6.1
github.com/urfave/cli v1.22.5
github.com/xdg/stringprep v1.0.0 // indirect
go.mongodb.org/mongo-driver v1.4.6
go.opencensus.io v0.22.6 // indirect
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
Expand All @@ -33,5 +31,3 @@ require (
)

replace git.apache.org/thrift.git => github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999

go 1.15
27 changes: 22 additions & 5 deletions go.sum

Large diffs are not rendered by default.

51 changes: 0 additions & 51 deletions integration-tests/amqp_amqp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ import (

"github.com/RichardKnop/machinery/v1"
"github.com/RichardKnop/machinery/v1/config"

amqpbackend "github.com/RichardKnop/machinery/v1/backends/amqp"
amqpbroker "github.com/RichardKnop/machinery/v1/brokers/amqp"
eagerlock "github.com/RichardKnop/machinery/v1/locks/eager"
machineryV2 "github.com/RichardKnop/machinery/v2"
)

func TestAmqpAmqp(t *testing.T) {
Expand Down Expand Up @@ -52,49 +47,3 @@ func TestAmqpAmqp(t *testing.T) {
go worker.Launch()
testAll(server, t)
}

func TestAmqpAmqp_V2(t *testing.T) {
amqpURL := os.Getenv("AMQP_URL")
if amqpURL == "" {
t.Skip("AMQP_URL is not defined")
}

finalAmqpURL := amqpURL
var finalSeparator string

amqpURLs := os.Getenv("AMQP_URLS")
if amqpURLs != "" {
separator := os.Getenv("AMQP_URLS_SEPARATOR")
if separator == "" {
return
}
finalSeparator = separator
finalAmqpURL = amqpURLs
}

cnf := &config.Config{
Broker: finalAmqpURL,
MultipleBrokerSeparator: finalSeparator,
DefaultQueue: "machinery_tasks",
ResultBackend: amqpURL,
ResultsExpireIn: 3600,
AMQP: &config.AMQPConfig{
Exchange: "test_exchange",
ExchangeType: "direct",
BindingKey: "test_task",
PrefetchCount: 1,
},
}

broker := amqpbroker.New(cnf)
backend := amqpbackend.New(cnf)
lock := eagerlock.New()
server := machineryV2.NewServer(cnf, broker, backend, lock)

registerTestTasks(server)

worker := server.NewWorker("test_worker", 0)
defer worker.Quit()
go worker.Launch()
testAll(server, t)
}
38 changes: 0 additions & 38 deletions integration-tests/redis_redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ import (

"github.com/RichardKnop/machinery/v1"
"github.com/RichardKnop/machinery/v1/config"

redisbackend "github.com/RichardKnop/machinery/v1/backends/redis"
redisbroker "github.com/RichardKnop/machinery/v1/brokers/redis"
eagerlock "github.com/RichardKnop/machinery/v1/locks/eager"
machineryV2 "github.com/RichardKnop/machinery/v2"
)

func TestRedisRedis_Redigo(t *testing.T) {
Expand All @@ -36,39 +31,6 @@ func TestRedisRedis_Redigo(t *testing.T) {
testAll(server, t)
}

func TestRedisRedis_V2_GoRedis(t *testing.T) {
redisURL := os.Getenv("REDIS_URL")
if redisURL == "" {
t.Skip("REDIS_URL is not defined")
}

cnf := &config.Config{
DefaultQueue: "machinery_tasks",
ResultsExpireIn: 3600,
Redis: &config.RedisConfig{
MaxIdle: 3,
IdleTimeout: 240,
ReadTimeout: 15,
WriteTimeout: 15,
ConnectTimeout: 15,
NormalTasksPollPeriod: 1000,
DelayedTasksPollPeriod: 500,
},
}

broker := redisbroker.NewGR(cnf, []string{redisURL}, 0)
backend := redisbackend.NewGR(cnf, []string{redisURL}, 0)
lock := eagerlock.New()
server := machineryV2.NewServer(cnf, broker, backend, lock)

registerTestTasks(server)

worker := server.NewWorker("test_worker", 0)
defer worker.Quit()
go worker.Launch()
testAll(server, t)
}

func TestRedisRedisNormalTaskPollPeriodLessThan1SecondShouldNotFailNextTask(t *testing.T) {
redisURL := os.Getenv("REDIS_URL")
if redisURL == "" {
Expand Down
Loading

0 comments on commit c7fb8ad

Please sign in to comment.