benoitc/gunicorn — pull request #649 by hongqn (2013-11-29 06:02:55+00:00)
Title: Run worker's setup early than set num_workers

`cfg.worker_class` is a property, which calls the classmethod `setup` of
the worker class when accessed. Gevent worker relies on this mechanism
to call `gevent.monkey.patch_all()`.

However, `num_workers` is a hooked property, when it is set, gunicorn
will call hook defined by user. If the hooked code relies on
gevent's monkey patch, it will fail because the monkey patch has not
been applied yet.

This commit makes sure that `worker_class` property getter invokes
before `num_workers` setter to resolve this problem.