Commit 6af27911326fa23d28852e9e440cd9f497a37c65
1 parent
f58c398a
Exists in
master
and in
29 other branches
Initializers: workaround DelayedJob usage on upgrades
No code on initializers should ever touch the database. During upgrades, that code will run when running migrations, i.e. while the database is still outdated.
Showing
2 changed files
with
4 additions
and
2 deletions
Show diff stats
config/initializers/activities_counter_cache.rb
1 | -if Delayed::Backend::ActiveRecord::Job.table_exists? | |
1 | +if Delayed::Backend::ActiveRecord::Job.table_exists? && | |
2 | + Delayed::Backend::ActiveRecord::Job.attribute_names.include?('queue') | |
2 | 3 | job = Delayed::Backend::ActiveRecord::Job.all :conditions => ['handler LIKE ?', "%ActivitiesCounterCacheJob%"] |
3 | 4 | if job.blank? |
4 | 5 | Delayed::Backend::ActiveRecord::Job.enqueue(ActivitiesCounterCacheJob.new, {:priority => -3}) | ... | ... |
config/initializers/person_notification.rb