xapian_db 1.3.8 → 1.3.10

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: a9a56c8dcca3d9af676803407a5f0ba9ca07d72a33c877909f9e5b7bc0ab884c
4
- data.tar.gz: 19f87585356eb95bbe54c4e22d10b770b953c09c74856ffe10441fcf053c530d
3
+ metadata.gz: 5a85e207edfe687e3cdb78beb5056f293b9b152a49ebf8c373e76a67c5057f06
4
+ data.tar.gz: 2c103133ef9838b3d243e640fb51d970acb77384ac45cced1269efeb38789479
5
5
  SHA512:
6
- metadata.gz: 107aa90d69efc2dccd06f104a66fd9b0a252491c1110ebbc879e3998c74fd7619b1c41c523af7f8017611287ad339290f5a0aec72b07825687873af9f6780ae4
7
- data.tar.gz: 3052ca4107227f97f48bbbc023478279e2f06c952b604d77269bb52ae3add718675940ce044a99b616037e801144ed09c474ad53ed7344853046e8200ce7d2aa
6
+ metadata.gz: c21ff4ce44b81671de58eae9cd2817e781f473fd6b4518bf5b77def92711e204fcbb3fab45cd245d0776149dedda799a17c56e36109f55c583d51c27c3c90d12
7
+ data.tar.gz: a0893f80236829214c7db92f5a0a60bdd72a68ff90fbb84131cdff4e7a531c22163563d2f150a18d09a344e9ba2b66cac17dedc21d1f2ba5756f9239149ed71c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 1.3.10 (March 2nd, 2023)
2
+
3
+ Fixes:
4
+
5
+ - Improved the code that reads the `xapian_db.yml` file to allow aliases in the yml file when using Ruby 3.1 or higher.
6
+
7
+ ## 1.3.9 (October 26th, 2022)
8
+
9
+ Fixes:
10
+
11
+ - `XapianDb.execute_block` now uses `Thread.current[:xapian_db_block_writer]` to store its block-local writer as to avoid leaking into another Thread
12
+
1
13
  ## 1.3.8 (July 19th, 2021)
2
14
 
3
15
  Fixes:
@@ -30,7 +30,11 @@ module XapianDb
30
30
  # Read the database configuration file if there is one
31
31
  config_file_path = "#{Rails.root}/config/xapian_db.yml"
32
32
  if File.exist?(config_file_path)
33
- db_config = YAML::load_file config_file_path
33
+ db_config = if YAML.respond_to?(:unsafe_load_file) # Psych 4.0 way
34
+ YAML.unsafe_load_file(config_file_path)
35
+ else
36
+ YAML.load_file(config_file_path)
37
+ end
34
38
  env_config = db_config[Rails.env]
35
39
  env_config ? configure_from(env_config) : configure_defaults
36
40
  else
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.10
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: 2023-03-02 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