about summary refs log tree commit diff
path: root/config
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-05-18 23:29:14 +0200
committerGitHub <noreply@github.com>2022-05-18 23:29:14 +0200
commit679b7158e3cd3881e8cbaf2d2c0c97725b3b5fd9 (patch)
tree9cc1dd73c3cd894207bf3c806234c8c919459985 /config
parentded5a0254a4d29a7384ef766a1e92467fe4ebd2b (diff)
Change search indexing to use batches to minimize resource usage (#18451)
Diffstat (limited to 'config')
-rw-r--r--config/application.rb2
-rw-r--r--config/initializers/chewy.rb5
-rw-r--r--config/sidekiq.yml4
3 files changed, 7 insertions, 4 deletions
diff --git a/config/application.rb b/config/application.rb
index 64987cfe7..24fa2a978 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -38,7 +38,7 @@ require_relative '../lib/mastodon/version'
 require_relative '../lib/mastodon/rack_middleware'
 require_relative '../lib/devise/two_factor_ldap_authenticatable'
 require_relative '../lib/devise/two_factor_pam_authenticatable'
-require_relative '../lib/chewy/strategy/custom_sidekiq'
+require_relative '../lib/chewy/strategy/mastodon'
 require_relative '../lib/webpacker/manifest_extensions'
 require_relative '../lib/webpacker/helper_extensions'
 require_relative '../lib/rails/engine_extensions'
diff --git a/config/initializers/chewy.rb b/config/initializers/chewy.rb
index f303fc54d..752fc3c6d 100644
--- a/config/initializers/chewy.rb
+++ b/config/initializers/chewy.rb
@@ -13,15 +13,14 @@ Chewy.settings = {
   journal: false,
   user: user,
   password: password,
-  sidekiq: { queue: 'pull' },
 }
 
 # We use our own async strategy even outside the request-response
 # cycle, which takes care of checking if Elasticsearch is enabled
 # or not. However, mind that for the Rails console, the :urgent
 # strategy is set automatically with no way to override it.
-Chewy.root_strategy              = :custom_sidekiq
-Chewy.request_strategy           = :custom_sidekiq
+Chewy.root_strategy              = :mastodon
+Chewy.request_strategy           = :mastodon
 Chewy.use_after_commit_callbacks = false
 
 module Chewy
diff --git a/config/sidekiq.yml b/config/sidekiq.yml
index 26be26326..2a3871468 100644
--- a/config/sidekiq.yml
+++ b/config/sidekiq.yml
@@ -21,6 +21,10 @@
     every: '6h'
     class: Scheduler::Trends::ReviewNotificationsScheduler
     queue: scheduler
+  indexing_scheduler:
+    every: '5m'
+    class: Scheduler::IndexingScheduler
+    queue: scheduler
   media_cleanup_scheduler:
     cron: '<%= Random.rand(0..59) %> <%= Random.rand(3..5) %> * * *'
     class: Scheduler::MediaCleanupScheduler