noiseless 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 466267a77224bbf9915eff8b198002c658e2e9c9d368c6c7f6e4e4ee32939892
4
- data.tar.gz: 71281cfbbcdd40f83f55eedb0fca494f1e0a75172c4a9523c3000cae81fa752d
3
+ metadata.gz: 191caa0c33ef498748dcff326328dbd5e02b7f3a225ef1999b91127edb23490b
4
+ data.tar.gz: 3260bb7ca298d9b3ccdfb9e89a5a6e89759dbe56e2637b811439653cef4f9673
5
5
  SHA512:
6
- metadata.gz: 7a0a6c9aa9134b043b4a87c8434735f837bca7cfc63520693e3bf49ff4001617351cf92259b73a781187fd22812d65f781130570f753d27dd68d4d6f3bb16fd0
7
- data.tar.gz: 14387643b5a8c5b5fc506e00b28b8d5b2664d359bd48797c6180df38f03efa370dd86d46d0a871194328ff80f487458e439733b250dfdad9cf369a253e069c3e
6
+ metadata.gz: eff7ee517dd4bea214b4602231baf34e518fc01546f3fe47f8b759aa75efb889aa6113bca2de56031b5ebf01ac893099217be4f5afc7af7c0802bf8686759601
7
+ data.tar.gz: f0cd3e05dafd3b3a86a7d6a278eac89a5230dbd859674fe209264e8b033a8ec75640a44d969ec1cf945e3ad414fa4137b9816871f1c05e9e30d1e6eb9957d6c9
@@ -39,6 +39,7 @@ module Noiseless
39
39
  private
40
40
 
41
41
  def should_update_search_index?
42
+ return false unless Noiseless.config.auto_index
42
43
  return false if Thread.current[:noiseless_skip_auto_index]
43
44
  return false unless self.class.auto_index_enabled?
44
45
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Noiseless
4
- VERSION = "0.5.0"
4
+ VERSION = "0.6.0"
5
5
  end
data/lib/noiseless.rb CHANGED
@@ -42,11 +42,16 @@ module Noiseless
42
42
 
43
43
  class Configuration
44
44
  attr_accessor :connections_config, :default_connection, :default_adapter, :config_path
45
+ # Global kill switch for model auto-indexing callbacks. Lets environments
46
+ # without a search backend (e.g. CI) run without connection-error noise on
47
+ # every save. Defaults to NOISELESS_AUTO_INDEX env var, on unless "false".
48
+ attr_accessor :auto_index
45
49
 
46
50
  def initialize
47
51
  @connections_config = {}
48
52
  @default_connection = :primary
49
53
  @default_adapter = :opensearch
54
+ @auto_index = ENV.fetch("NOISELESS_AUTO_INDEX", "true") != "false"
50
55
  @config_path = lambda do
51
56
  if defined?(Rails) && Rails.respond_to?(:root) && Rails.root
52
57
  Rails.root.join("config/noiseless.yml")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noiseless
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih
@@ -294,7 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
294
294
  - !ruby/object:Gem::Version
295
295
  version: '0'
296
296
  requirements: []
297
- rubygems_version: 3.6.9
297
+ rubygems_version: 4.0.10
298
298
  specification_version: 4
299
299
  summary: Async-first Rails search abstraction with multi-backend support
300
300
  test_files: []