Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing prefillParallelism argument in redis.go newRedisPool function #78

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ func init() {
Concurrency: 2,
Namespace: "resque:",
Interval: 5.0,
PrefillParallelism: 0,
}
goworker.SetSettings(settings)
goworker.Register("MyClass", myFunc)
Expand Down
29 changes: 15 additions & 14 deletions goworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it okay to use camelCase here? In the README you are using PascalCase.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing, fixed it

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad to be able to help.

}

func SetSettings(settings WorkerSettings) {
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down