diff --git a/enqueue.go b/enqueue.go index 409afcdd..9dfd8e58 100644 --- a/enqueue.go +++ b/enqueue.go @@ -18,6 +18,10 @@ type Enqueuer struct { // NewEnqueuer creates a new enqueuer with the specified Redis namespace and Redis pool. func NewEnqueuer(namespace string, pool *redis.Pool) *Enqueuer { + if pool == nil { + panic("NewEnqueuer needs a non-nil *redis.Pool") + } + return &Enqueuer{ Namespace: namespace, Pool: pool, diff --git a/worker_pool.go b/worker_pool.go index 104005c6..75e4876a 100644 --- a/worker_pool.go +++ b/worker_pool.go @@ -63,6 +63,10 @@ type middlewareHandler struct { // NewWorkerPool creates a new worker pool. ctx should be a struct literal whose type will be used for middleware and handlers. concurrency specifies how many workers to spin up - each worker can process jobs concurrently. func NewWorkerPool(ctx interface{}, concurrency uint, namespace string, pool *redis.Pool) *WorkerPool { + if pool == nil { + panic("NewWorkerPool needs a non-nil *redis.Pool") + } + ctxType := reflect.TypeOf(ctx) validateContextType(ctxType) wp := &WorkerPool{