Delay DUS scripts via WORKERS_DATA_UPDATE_DELAY_SECONDS in rake otherwise default run them immediately (#14166)
* Allow DATA_UPDATE_WORKER_DELAY to be set otherwise run DataUpdateScripts immediately in the background * update var name and comment * set a heroku friendly default * Update ENV variable name
This commit is contained in:
parent
159de0afc3
commit
4d77e7c1e9
1 changed files with 9 additions and 2 deletions
|
|
@ -4,8 +4,15 @@ namespace :data_updates do
|
|||
if Rails.env.development?
|
||||
Rake::Task["data_updates:run"].execute
|
||||
else
|
||||
# Ensure new code has been deployed before we run our update scripts
|
||||
DataUpdateWorker.perform_in(10.minutes)
|
||||
# @mstruve: Due to many folks already hosting their Forems on Heroku lets
|
||||
# set a friendly default for them. Ideally we get everyone to use
|
||||
# the ENV variable below but until we can do a hard cut over with
|
||||
# a version I think this is a good compromise
|
||||
default_delay = ENV["HEROKU_SLUG_COMMIT"].present? ? 10.minutes : 0
|
||||
|
||||
# Use the env variable to delay running data update scripts if your
|
||||
# deploy strategy requires it
|
||||
DataUpdateWorker.perform_in(ENV["WORKERS_DATA_UPDATE_DELAY_SECONDS"] || default_delay)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue