Open enriquebris opened 5 years ago
This PR adds a new feature: (optional) queue priorities.
Starting now queue's priority could be defined, meaning that jobs from a queue with higher priority will be pulled before jobs from a queue with lower priority.
settings := goworker.WorkerSettings{ URI: "redis://localhost:6379/", Connections: 100, Queues: []string{"med-priority", "low-priority", "high-priority"}, QueuesPriority: map[string]int{ "high-priority": 10, "med-priority": 100, "low-priority": 200, }, UseNumber: true, ExitOnComplete: false, Concurrency: 2, Namespace: "resque:", Interval: 5.0, } goworker.SetSettings(settings)
Priorities could be defined from 0 to the max int value. Smaller values mean higher priority. Zero is the highest priority.
Those queues with no defined priority will automatically get the highest priority (zero).
All the following scenarios are valid:
This new feature does not introduce any compatibility issue with code bases using previous versions.
This PR includes #71
This PR adds a new feature: (optional) queue priorities.
Starting now queue's priority could be defined, meaning that jobs from a queue with higher priority will be pulled before jobs from a queue with lower priority.
How to define priorities:
Values
Priorities could be defined from 0 to the max int value. Smaller values mean higher priority. Zero is the highest priority.
Those queues with no defined priority will automatically get the highest priority (zero).
How optional is this?
All the following scenarios are valid:
Compatibility
This new feature does not introduce any compatibility issue with code bases using previous versions.
Other PRs
This PR includes #71