diff --git a/config/application.rb b/config/application.rb index 864917c..5a9e98b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -36,18 +36,12 @@ class Application < Rails::Application # config.time_zone = "Central Time (US & Canada)" # config.eager_load_paths << Rails.root.join("extras") + # Use GoodJob for Active Job queue adapter + config.active_job.queue_adapter = :good_job + # Only loads a smaller set of middleware suitable for API only apps. # Middleware like session, flash, cookies can be added back manually. # Skip views, helpers and assets when generating a new resource. config.api_only = false - - config.good_job.cron = { - feed_refresh: { # each recurring job must have a unique key - cron: "every 3 hours", # cron-style scheduling format by fugit gem - class: "FeedRefresherJob", # name of the job class as a String; must reference an Active Job job class - description: "Refreshed feeds and creates new entries", # optional description that appears in Dashboard, - enabled_by_default: -> { Rails.env.production? } # Only enable in production, otherwise can be enabled manually through Dashboard - } - } end end diff --git a/config/environments/development.rb b/config/environments/development.rb index 55bccb4..3426435 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -53,9 +53,6 @@ # Highlight code that enqueued background job in logs. config.active_job.verbose_enqueue_logs = true - # Use GoodJob for Active Job queue adapter - config.active_job.queue_adapter = :good_job - # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true diff --git a/config/environments/production.rb b/config/environments/production.rb index 18180c5..a449cbd 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -46,11 +46,6 @@ # Replace the default in-process memory cache store with a durable alternative. # config.cache_store = :mem_cache_store - # Replace the default in-process and non-durable queuing backend for Active Job. - config.active_job.queue_adapter = :good_job - - config.good_job.cron_graceful_restart_period = 1.minute - # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false diff --git a/config/initializers/good_job.rb b/config/initializers/good_job.rb index 1ef8792..f00d882 100644 --- a/config/initializers/good_job.rb +++ b/config/initializers/good_job.rb @@ -1,13 +1,23 @@ # GoodJob configuration Rails.application.configure do # Configure GoodJob settings - config.good_job.execution_mode = :external + # config.good_job.execution_mode = :external config.good_job.max_threads = 5 config.good_job.poll_interval = 30 config.good_job.shutdown_timeout = 25 # Enable cron jobs config.good_job.enable_cron = true + config.good_job.cron_graceful_restart_period = 1.minute + + config.good_job.cron = { + feed_refresh: { # each recurring job must have a unique key + cron: "every 3 hours", # cron-style scheduling format by fugit gem + class: "FeedRefresherJob", # name of the job class as a String; must reference an Active Job job class + description: "Refreshed feeds and creates new entries", # optional description that appears in Dashboard, + enabled_by_default: -> { Rails.env.production? } # Only enable in production, otherwise can be enabled manually through Dashboard + } + } # Preserve job records for debugging config.good_job.preserve_job_records = true @@ -19,6 +29,7 @@ # Queue configuration config.good_job.queues = "*" + # Smaller batch size for better performance config.good_job.cleanup_interval_jobs = 1000 config.good_job.cleanup_interval_seconds = 600 diff --git a/config/routes.rb b/config/routes.rb index e12ed4c..44842ed 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,4 @@ Rails.application.routes.draw do - resources :evidences if Rails.env.development? mount GoodJob::Engine => "/admin/good_job" mount Avo::Engine => "/admin"