From a154f20569d6b79f690790c3a59988955f1fa349 Mon Sep 17 00:00:00 2001 From: NoumanArshad83 Date: Tue, 17 Dec 2019 09:27:44 +0500 Subject: [PATCH 1/3] Added missing param in newRedisPool and updated readme example --- README.md | 1 + redis.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2f273ef3..dd477c05 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ func init() { Concurrency: 2, Namespace: "resque:", Interval: 5.0, + PrefillParallelism: 0, } goworker.SetSettings(settings) goworker.Register("MyClass", myFunc) diff --git a/redis.go b/redis.go index 085993b0..a0a1c000 100644 --- a/redis.go +++ b/redis.go @@ -31,8 +31,8 @@ func newRedisFactory(uri string) pools.Factory { } } -func newRedisPool(uri string, capacity int, maxCapacity int, idleTimout time.Duration) *pools.ResourcePool { - return pools.NewResourcePool(newRedisFactory(uri), capacity, maxCapacity, idleTimout) +func newRedisPool(uri string, capacity int, maxCapacity int, idleTimout time.Duration, prefillParallelism int) *pools.ResourcePool { + return pools.NewResourcePool(newRedisFactory(uri), capacity, maxCapacity, idleTimout, prefillParallelism) } func redisConnFromURI(uriString string) (*RedisConn, error) { From 7469966ff0604d49ec14f5ff2f32483e7ce56225 Mon Sep 17 00:00:00 2001 From: NoumanArshad83 Date: Tue, 17 Dec 2019 09:55:01 +0500 Subject: [PATCH 2/3] Added prefillParallelism in goworker.go struct and Init function --- goworker.go | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/goworker.go b/goworker.go index cf2faad8..67f74c29 100644 --- a/goworker.go +++ b/goworker.go @@ -23,19 +23,20 @@ var ( var workerSettings WorkerSettings type WorkerSettings struct { - QueuesString string - Queues queuesFlag - IntervalFloat float64 - Interval intervalFlag - Concurrency int - Connections int - URI string - Namespace string - ExitOnComplete bool - IsStrict bool - UseNumber bool - SkipTLSVerify bool - TLSCertPath string + QueuesString string + Queues queuesFlag + IntervalFloat float64 + Interval intervalFlag + Concurrency int + Connections int + URI string + Namespace string + ExitOnComplete bool + IsStrict bool + UseNumber bool + SkipTLSVerify bool + TLSCertPath string + prefillParallelism int } func SetSettings(settings WorkerSettings) { @@ -61,7 +62,7 @@ func Init() error { } ctx = context.Background() - pool = newRedisPool(workerSettings.URI, workerSettings.Connections, workerSettings.Connections, time.Minute) + pool = newRedisPool(workerSettings.URI, workerSettings.Connections, workerSettings.Connections, time.Minute, workerSettings.prefillParallelism) initialized = true } From 10a351e0975f624177a719546d629d24f3e685da Mon Sep 17 00:00:00 2001 From: NoumanArshad83 Date: Tue, 18 Feb 2020 04:48:23 +0500 Subject: [PATCH 3/3] Changed camelCass to PascalCase --- goworker.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/goworker.go b/goworker.go index 67f74c29..e08fc503 100644 --- a/goworker.go +++ b/goworker.go @@ -36,7 +36,7 @@ type WorkerSettings struct { UseNumber bool SkipTLSVerify bool TLSCertPath string - prefillParallelism int + PrefillParallelism int } func SetSettings(settings WorkerSettings) { @@ -62,7 +62,7 @@ func Init() error { } ctx = context.Background() - pool = newRedisPool(workerSettings.URI, workerSettings.Connections, workerSettings.Connections, time.Minute, workerSettings.prefillParallelism) + pool = newRedisPool(workerSettings.URI, workerSettings.Connections, workerSettings.Connections, time.Minute, workerSettings.PrefillParallelism) initialized = true }