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

Namespace Configuration Env Vars with Backwards Compatibility #1046

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tonyta
Copy link

@tonyta tonyta commented Aug 22, 2018

Related to issue #1028.

Namespace all configuration variables used by Delayed::Job under the DELAYED_JOB_-prefix.

MAX_PRIORITY   👉   DELAYED_JOB_MAX_PRIORITY
MIN_PRIORITY   👉   DELAYED_JOB_MIN_PRIORITY
QUEUE          👉   DELAYED_JOB_QUEUE
QUEUES         👉   DELAYED_JOB_QUEUES
QUIET          👉   DELAYED_JOB_QUIET
READ_AHEAD     👉   DELAYED_JOB_READ_AHEAD
SLEEP_DELAY    👉   DELAYED_JOB_SLEEP_DELAY

This will allow developers to easily figure out what the env var is used for at a glance and prevent collisions with other libraries using similarly named variable names.

Allow non-namespaced configuration variables as a fallback, but with a deprecation warning.

Example usages:

With deprecated vars:

$ MAX_PRIORITY=1 \
* MIN_PRIORITY=1 \
* QUEUES=email,import \
* READ_AHEAD=5 \
* SLEEP_DELAY=25 \
* bundle exec rake jobs:work
[DEPRECATION] 'MIN_PRIORITY' for configuration is deprecated. Use 'DELAYED_JOB_MIN_PRIORITY'
[DEPRECATION] 'MAX_PRIORITY' for configuration is deprecated. Use 'DELAYED_JOB_MAX_PRIORITY'
[DEPRECATION] 'QUEUES' for configuration is deprecated. Use 'DELAYED_JOB_QUEUES'
[DEPRECATION] 'SLEEP_DELAY' for configuration is deprecated. Use 'DELAYED_JOB_SLEEP_DELAY'
[DEPRECATION] 'SLEEP_DELAY' for configuration is deprecated. Use 'DELAYED_JOB_SLEEP_DELAY'
[DEPRECATION] 'READ_AHEAD' for configuration is deprecated. Use 'DELAYED_JOB_READ_AHEAD'
[DEPRECATION] 'READ_AHEAD' for configuration is deprecated. Use 'DELAYED_JOB_READ_AHEAD'
[Worker(host:tonyta.local pid:42629)] Starting job worker
[Worker(host:tonyta.local pid:42629)] Exiting...

With namespace vars:

$ DELAYED_JOB_MAX_PRIORITY=1 \
* DELAYED_JOB_MIN_PRIORITY=1 \
* DELAYED_JOB_QUEUES=email,import \
* DELAYED_JOB_READ_AHEAD=5 \
* DELAYED_JOB_SLEEP_DELAY=25 \
* bundle exec rake jobs:work
[Worker(host:tonyta.local pid:42711)] Starting job worker
[Worker(host:tonyta.local pid:42711)] Exiting...

Namespace all configuration variables used by Delayed::Job under the
`DELAYED_JOB_`-prefix. This will allow developers to easily figure out
what the env var is used for at a glance and prevent collisions with
other libraries using similarly named variable names.

Allow non-namespaced configuration variables as a fallback, but with a
deprecation warning.

See collectiveidea#1028
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant