PeopleAdmin/resque-pool — pull request #1 by mattdbridges (2013-09-24 16:18:23+00:00)
Title: Introduce configuration override

In normal use of Resque::Pool, having a static YAML file for pool configuration is fine. However, at high stress levels for particular queues, changing the configuration on the fly is not currently possible. While this isn't necessarily something Resque::Pool needs to manage, it is currently impossible to refresh queue configuration on the fly without monkey-patching.

This is where the idea of a configuration override comes in. Pass a callable object as the second parameter of a Resque::Pool instance that returns a Resque::Pool compatible Hash configuration.

```ruby
queue_configurator = ->(config) {
{ 'foo,bar,baz' => 200 }
}

pool = Resque::Pool.config({'a' => 1}, queue_configurator)
pool.refresh_config
pool.config
# -> { 'foo,bar,baz' => 200 }

# You can also set a global config override this way
Resque::Pool.config_override = ->(config) { config.merge({"totaly,awesome" => 10000}) )
Resque::Pool.run # will use above lambda and merge into existing config
```

This opens the door to dynamic configuration that is either server-specific or even based on a database-backed solution.