Skip to content

Commit

Permalink
Ensures ThinkingSphinx preloads the all the indices
Browse files Browse the repository at this point in the history
Otherwise concurrent threads (e.g. sidekiq, puma) can deadlock while
racing to obtain access to the mutex block at
https://github.com/pat/thinking-sphinx/blob/v3.4.2/lib/thinking_sphinx/configuration.rb#L78.

This bug was fixed in ThinkingSphinx v4.3.0+.

See
- pat/thinking-sphinx#1051
- pat/thinking-sphinx#1132
  • Loading branch information
guicassolato committed Jul 2, 2020
1 parent 40a8c62 commit 0c59a44
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/initializers/sphinx.rb
@@ -1,3 +1,8 @@
SPHINX_DELTA_INTERVAL = 90.minutes

ThinkingSphinx::Callbacks.suspend!

# Prevents concurrent threads (e.g. sidekiq, puma) to deadlock while racing to obtain access to the mutex block at https://github.com/pat/thinking-sphinx/blob/v3.4.2/lib/thinking_sphinx/configuration.rb#L78
# This is a ThinkingSphinx's known bug, fixed in v4.3.0+ - see: https://github.com/pat/thinking-sphinx/commit/814beb0aa3d9dd1227c0f41d630888a738f7c0d6
# See also https://github.com/pat/thinking-sphinx/issues/1051 and https://github.com/pat/thinking-sphinx/issues/1132
ThinkingSphinx::Configuration.instance.preload_indices if Rails.env.development?

0 comments on commit 0c59a44

Please sign in to comment.