xapian_db 1.3.12 → 1.3.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10c83c4915676e35cda8a6f364577e016a85e20286398497a9c836096a54fb81
4
- data.tar.gz: 07c4310598ba2dcd13424cbc50b23b8fd5989bfb898b416f56f353de52f19797
3
+ metadata.gz: a29f75d11adde6b1e29a279ca708947892348e8cec46d5713a830c71c02b5885
4
+ data.tar.gz: 4d466f487f8c9df855d6a3ba49a28201e7aad91ff9efec6c8aa7a827dd25e616
5
5
  SHA512:
6
- metadata.gz: 40e04a7578ed2f9619642e3a8959d7d207b80179a9b08bd3e980e49bf8a83c42963e1d80857a872a534dc34c00e92f47c0164533641e26626d383cfbb1c81903
7
- data.tar.gz: 47b10314479c53db6bfb53f57bec32dae99f2bd35061133e0b4da4a46885c0295777ff1d3450c937a701648fefd52a61db24fe8add0bf468d52fe60898196bfb
6
+ metadata.gz: a3ef99e32b11ea43b1d5147036ad9e52a9fa513a4298d3800f24534837d4cf8c3e7a950fb6cd90f7abd81e3837901926fbf9ec0d2a66afdcf5b1ba11cd29a143
7
+ data.tar.gz: 30afda34bf9dfbcbf8d8f3838c8dd6971cacc19f8846ee5ec22a4fcdb70bb275e374e7e6f3c847e138cb30cc269b1b53289ba4737bc514b679305133415d230c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.3.13 (August 26th, 2024)
2
+
3
+ Changes:
4
+
5
+ - make sidekiq_retry configurable for Xapian
6
+
1
7
  ## 1.3.12 (August 23th, 2024)
2
8
 
3
9
  Changes:
data/README.rdoc CHANGED
@@ -537,8 +537,10 @@ Install and start redis as described on the {resque github page}[https://github.
537
537
  writer: sidekiq
538
538
  sidekiq_queue: my_queue
539
539
  set_max_expansion: 100
540
+ sidekiq_retry: false
540
541
 
541
542
  If you don't specify a queue name XapianDb will use 'xapian_db' by default.
543
+ Additionally, if you don't provide a 'sidekiq_retry' option, it will default to 'false'.
542
544
 
543
545
  === 4. Start sidekiq
544
546
 
@@ -61,6 +61,10 @@ module XapianDb
61
61
  @config.instance_variable_get("@_set_max_expansion")
62
62
  end
63
63
 
64
+ def sidekiq_retry
65
+ @config.instance_variable_get("@_sidekiq_retry") || false
66
+ end
67
+
64
68
  def term_splitter_count
65
69
  @config.instance_variable_get("@_term_splitter_count") || 0
66
70
  end
@@ -78,8 +82,9 @@ module XapianDb
78
82
  # DSL methods
79
83
  # ---------------------------------------------------------------------------------
80
84
 
81
- attr_reader :_database, :_adapter, :_writer, :_beanstalk_daemon, :_resque_queue, :_sidekiq_queue,
82
- :_stemmer, :_stopper, :_term_min_length, :_term_splitter_count, :_enabled_query_flags, :_set_max_expansion
85
+ attr_reader :_database, :_adapter, :_writer, :_beanstalk_daemon, :_resque_queue, :_sidekiq_queue,
86
+ :_stemmer, :_stopper, :_term_min_length, :_term_splitter_count, :_enabled_query_flags,
87
+ :_set_max_expansion, :_sidekiq_retry
83
88
 
84
89
  # Set the global database to use
85
90
  # @param [String] path The path to the database. Either apply a file sytem path or :memory
@@ -159,6 +164,12 @@ module XapianDb
159
164
  @_set_max_expansion = value
160
165
  end
161
166
 
167
+ # Set the value for the Sidekiq retry setting.
168
+ # @param [Boolean, Numeric] value The value to set for the Sidekiq retry setting.
169
+ def sidekiq_retry(value)
170
+ @_sidekiq_retry = value
171
+ end
172
+
162
173
  # Set the language.
163
174
  # @param [Symbol] lang The language; apply the two letter ISO639 code for the language
164
175
  # @example
@@ -44,6 +44,10 @@ module XapianDb
44
44
  def set_max_expansion
45
45
  XapianDb::Config.set_max_expansion
46
46
  end
47
+
48
+ def sidekiq_retry
49
+ XapianDb::Config.sidekiq_retry
50
+ end
47
51
  end
48
52
  end
49
53
  end
@@ -15,39 +15,45 @@ module XapianDb
15
15
  end
16
16
 
17
17
  class << self
18
-
19
- # Update an object in the index
20
- # @param [Object] obj An instance of a class with a blueprint configuration
21
-
22
18
  def queue
23
19
  XapianDb::Config.sidekiq_queue
24
20
  end
25
21
 
22
+ # Update an object in the index
23
+ # @param [Object] obj An instance of a class with a blueprint configuration
26
24
  def index(obj, _commit= true, changed_attrs: [])
27
- Sidekiq::Client.enqueue_to(queue, worker_class, 'index',
28
- {
29
- class: obj.class.name,
30
- id: obj.id,
31
- changed_attrs: changed_attrs
32
- }.to_json)
25
+ Sidekiq::Client.push('queue' => queue,
26
+ 'class' => worker_class,
27
+ 'args' => ['index', { class: obj.class.name, id: obj.id, changed_attrs: changed_attrs }.to_json],
28
+ 'retry' => sidekiq_retry)
33
29
  end
34
30
 
35
31
  # Remove an object from the index
36
32
  # @param [String] xapian_id The document id
37
33
  def delete_doc_with(xapian_id, _commit= true)
38
- Sidekiq::Client.enqueue_to(queue, worker_class, 'delete_doc', { xapian_id: xapian_id }.to_json)
34
+ Sidekiq::Client.push('queue' => queue,
35
+ 'class' => worker_class,
36
+ 'args' => ['delete_doc', { xapian_id: xapian_id }.to_json],
37
+ 'retry' => sidekiq_retry)
39
38
  end
40
39
 
41
40
  # Reindex all objects of a given class
42
41
  # @param [Class] klass The class to reindex
43
42
  def reindex_class(klass, _options = {})
44
- Sidekiq::Client.enqueue_to(queue, worker_class, 'reindex_class', { class: klass.name }.to_json)
43
+ Sidekiq::Client.push('queue' => queue,
44
+ 'class' => worker_class,
45
+ 'args' => ['reindex_class', { class: klass.name }.to_json],
46
+ 'retry' => sidekiq_retry)
45
47
  end
46
48
 
47
49
  def set_max_expansion
48
50
  XapianDb::Config.set_max_expansion
49
51
  end
50
52
 
53
+ def sidekiq_retry
54
+ XapianDb::Config.sidekiq_retry
55
+ end
56
+
51
57
  def worker_class
52
58
  SidekiqWorker
53
59
  end
@@ -59,6 +59,7 @@ module XapianDb
59
59
  config.term_min_length @term_min_length
60
60
  config.term_splitter_count @term_splitter_count
61
61
  config.set_max_expansion @set_max_expansion
62
+ config.sidekiq_retry @sidekiq_retry
62
63
  @enabled_query_flags.each { |flag| config.enable_query_flag flag }
63
64
  @disabled_query_flags.each { |flag| config.disable_query_flag flag }
64
65
  end
@@ -87,6 +88,7 @@ module XapianDb
87
88
  @enable_phrase_search = env_config["enable_phrase_search"] == true
88
89
  @term_splitter_count = env_config["term_splitter_count"] || 0
89
90
  @set_max_expansion = env_config["set_max_expansion"]
91
+ @sidekiq_retry = env_config["sidekiq_retry"]
90
92
 
91
93
  if env_config["enabled_query_flags"]
92
94
  @enabled_query_flags = []
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xapian_db
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.12
4
+ version: 1.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gernot Kogler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-23 00:00:00.000000000 Z
11
+ date: 2024-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons
@@ -260,7 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
260
  - !ruby/object:Gem::Version
261
261
  version: 1.3.6
262
262
  requirements: []
263
- rubygems_version: 3.4.21
263
+ rubygems_version: 3.3.14
264
264
  signing_key:
265
265
  specification_version: 4
266
266
  summary: Ruby library to use a Xapian db as a key/value store with high performance