Module: SunspotOffline
- Defined in:
- lib/sunspot_offline.rb,
lib/sunspot_offline/version.rb,
lib/sunspot_offline/rsolr/client.rb,
lib/sunspot_offline/rails/railtie.rb,
lib/sunspot_offline/sidekiq/index_worker.rb,
lib/sunspot_offline/sidekiq/removal_worker.rb,
lib/sunspot_offline/sunspot/abstract_search.rb,
lib/sunspot_offline/sidekiq/current_job_middleware.rb
Defined Under Namespace
Modules: RSolr, Rails, Sidekiq, Sunspot
Constant Summary
collapse
- VERSION =
'0.1.0'
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/sunspot_offline.rb', line 9
def configuration
@configuration ||= OpenStruct.new(
retry_delay: 1.hour,
solr_error_callback: ->(_exception) {},
filter_sidekiq_job_callback: ->(_job) { false },
index_job: Sidekiq::IndexWorker,
removal_job: Sidekiq::RemovalWorker,
default_queue: 'default'
)
end
|
20
21
22
23
24
25
26
27
|
# File 'lib/sunspot_offline.rb', line 20
def configure
if block_given?
yield(configuration)
[SunspotOffline::Sidekiq::IndexWorker, SunspotOffline::Sidekiq::RemovalWorker].each do |worker|
worker.sidekiq_options[:queue] = configuration.default_queue
end
end
end
|
.filter_sidekiq_job?(job_class_name) ⇒ Boolean
33
34
35
|
# File 'lib/sunspot_offline.rb', line 33
def filter_sidekiq_job?(job_class_name)
configuration.filter_sidekiq_job_callback.call(job_class_name) if configuration.filter_sidekiq_job_callback
end
|
.on_solr_error(exception) ⇒ Object
29
30
31
|
# File 'lib/sunspot_offline.rb', line 29
def on_solr_error(exception)
configuration.solr_error_callback.call(exception) if configuration.solr_error_callback
end
|