xapian_db 1.3.8 → 1.3.9

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/lib/xapian_db.rb +5 -5
  4. metadata +3 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9a56c8dcca3d9af676803407a5f0ba9ca07d72a33c877909f9e5b7bc0ab884c
4
- data.tar.gz: 19f87585356eb95bbe54c4e22d10b770b953c09c74856ffe10441fcf053c530d
3
+ metadata.gz: a219ad5e9648568bdf084f50f5639133fb493a5dd6ec44c59e2adb03102c4bdc
4
+ data.tar.gz: 472fa6a0894c26c46991d61cd891202aa444f92b661b2f3172856e050e6f30d5
5
5
  SHA512:
6
- metadata.gz: 107aa90d69efc2dccd06f104a66fd9b0a252491c1110ebbc879e3998c74fd7619b1c41c523af7f8017611287ad339290f5a0aec72b07825687873af9f6780ae4
7
- data.tar.gz: 3052ca4107227f97f48bbbc023478279e2f06c952b604d77269bb52ae3add718675940ce044a99b616037e801144ed09c474ad53ed7344853046e8200ce7d2aa
6
+ metadata.gz: 8f4084aed2f0fce0edc901f695d076d740a61b72ea8e2ccd9b7315af3b7b389478da74d176e2bebf019d8d7f57632595cdc9a436df875c9f5ad16541f49ae96f
7
+ data.tar.gz: 3f7463fab1bfdec7ff5c47306243c6c48ed10abfb0fbda970246bbc08289431e14c625ef6b98b53013182ac2ac5c9b07565739ec801f1e3add5f8720cf7f661a
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.3.9 (October 26th, 2022)
2
+
3
+ Fixes:
4
+
5
+ - `XapianDb.execute_block` now uses `Thread.current[:xapian_db_block_writer]` to store its block-local writer as to avoid leaking into another Thread
6
+
1
7
  ## 1.3.8 (July 19th, 2021)
2
8
 
3
9
  Fixes:
data/lib/xapian_db.rb CHANGED
@@ -106,21 +106,21 @@ module XapianDb
106
106
  # Update an object in the index
107
107
  # @param [Object] obj An instance of a class with a blueprint configuration
108
108
  def self.index(obj, commit=true, changed_attrs: [])
109
- writer = @block_writer || XapianDb::Config.writer
109
+ writer = Thread.current[:xapian_db_block_writer] || XapianDb::Config.writer
110
110
  writer.index obj, commit, changed_attrs: changed_attrs
111
111
  end
112
112
 
113
113
  # Remove a document from the index
114
114
  # @param [String] xapian_id The document id
115
115
  def self.delete_doc_with(xapian_id, commit=true)
116
- writer = @block_writer || XapianDb::Config.writer
116
+ writer = Thread.current[:xapian_db_block_writer] || XapianDb::Config.writer
117
117
  writer.delete_doc_with xapian_id, commit
118
118
  end
119
119
 
120
120
  # Update or delete a xapian document belonging to an object depending on the ignore_if logic(if present)
121
121
  # @param [Object] object An instance of a class with a blueprint configuration
122
122
  def self.reindex(object, commit=true, changed_attrs: [])
123
- writer = @block_writer || XapianDb::Config.writer
123
+ writer = Thread.current[:xapian_db_block_writer] || XapianDb::Config.writer
124
124
  blueprint = XapianDb::DocumentBlueprint.blueprint_for object.class.name
125
125
  if blueprint.should_index?(object)
126
126
  writer.index object, commit, changed_attrs: changed_attrs
@@ -174,7 +174,7 @@ module XapianDb
174
174
  # @option opts [Object] :writer An index writer
175
175
  # @option opts [String] :error_message the error message to log if an error occurs
176
176
  def self.execute_block(opts, &block)
177
- @block_writer = opts[:writer]
177
+ Thread.current[:xapian_db_block_writer] = opts[:writer]
178
178
  begin
179
179
  block.call
180
180
  rescue Exception => ex
@@ -188,7 +188,7 @@ module XapianDb
188
188
  raise
189
189
  ensure
190
190
  # release the block writer
191
- @block_writer = nil
191
+ Thread.current[:xapian_db_block_writer] = nil
192
192
  end
193
193
  end
194
194
  end
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.8
4
+ version: 1.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gernot Kogler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-19 00:00:00.000000000 Z
11
+ date: 2022-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons
@@ -260,8 +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
- rubyforge_project:
264
- rubygems_version: 2.7.6
263
+ rubygems_version: 3.3.14
265
264
  signing_key:
266
265
  specification_version: 4
267
266
  summary: Ruby library to use a Xapian db as a key/value store with high performance