search-engine-for-typesense 30.1.6.10 → 30.1.6.11
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f539715e56d25adec8340f5ef92aa4897e8494e5dd1d17a19e9e974a440d8b9
|
|
4
|
+
data.tar.gz: 8e15d07dfd0ac820a934ef8d53b7a36c3cd86c24b1c248fd2ef1922e8f8b9622
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a9b03abc402eec4c55a781ad6f9dae88f7c1c3ffc6fd64ca5b6fba1be34202c394aceb62dc1ed9734b31bc3f9f2bdf55294a97c3c9c9db6a9440f5ba31fad28b
|
|
7
|
+
data.tar.gz: cd8c090303502de20f4d6f0852f0c769540c2cedd0ee3b6423eb6afa44bdbd5bcf2c472a610935d7114153a8cada8e80763efab0813c86e90833470034c2c7f3
|
|
@@ -79,12 +79,18 @@ module SearchEngine
|
|
|
79
79
|
step = SearchEngine::Logging::StepLine.new('Schema')
|
|
80
80
|
if missing
|
|
81
81
|
step.update('creating')
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
begin
|
|
83
|
+
SearchEngine::Schema.apply!(self, client: client) do |new_physical|
|
|
84
|
+
step.yield_line!
|
|
85
|
+
indexed_inside_apply = __se_index_partitions!(into: new_physical)
|
|
86
|
+
__se_abort_apply_if_failed!(indexed_inside_apply)
|
|
87
|
+
end
|
|
88
|
+
applied = true
|
|
89
|
+
step.finish('created')
|
|
90
|
+
rescue SearchEngine::Errors::IndexationAborted
|
|
91
|
+
applied = true
|
|
92
|
+
step.finish_warn('created (indexing failed — alias not swapped)')
|
|
85
93
|
end
|
|
86
|
-
applied = true
|
|
87
|
-
step.finish('created')
|
|
88
94
|
else
|
|
89
95
|
step.skip('collection present')
|
|
90
96
|
end
|
|
@@ -115,12 +121,18 @@ module SearchEngine
|
|
|
115
121
|
step = SearchEngine::Logging::StepLine.new('Schema Apply')
|
|
116
122
|
if drift
|
|
117
123
|
step.update('applying')
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
124
|
+
begin
|
|
125
|
+
SearchEngine::Schema.apply!(self, client: client, force_rebuild: force_rebuild) do |new_physical|
|
|
126
|
+
step.yield_line!
|
|
127
|
+
indexed_inside_apply = __se_index_partitions!(into: new_physical)
|
|
128
|
+
__se_abort_apply_if_failed!(indexed_inside_apply)
|
|
129
|
+
end
|
|
130
|
+
applied = true
|
|
131
|
+
step.finish('applied')
|
|
132
|
+
rescue SearchEngine::Errors::IndexationAborted
|
|
133
|
+
applied = true
|
|
134
|
+
step.finish_warn('applied (indexing failed — alias not swapped)')
|
|
121
135
|
end
|
|
122
|
-
applied = true
|
|
123
|
-
step.finish('applied')
|
|
124
136
|
else
|
|
125
137
|
step.skip
|
|
126
138
|
end
|
|
@@ -283,6 +295,15 @@ module SearchEngine
|
|
|
283
295
|
end
|
|
284
296
|
# rubocop:enable Metrics/PerceivedComplexity, Metrics/AbcSize
|
|
285
297
|
|
|
298
|
+
# Raise {SearchEngine::Errors::IndexationAborted} when the result
|
|
299
|
+
# from {__se_index_partitions!} indicates a non-ok status. Called
|
|
300
|
+
# inside a {Schema.apply!} block to prevent the alias swap.
|
|
301
|
+
def __se_abort_apply_if_failed!(result)
|
|
302
|
+
return unless result.is_a?(Hash) && result[:status] != :ok
|
|
303
|
+
|
|
304
|
+
raise SearchEngine::Errors::IndexationAborted, result
|
|
305
|
+
end
|
|
306
|
+
|
|
286
307
|
def __se_retention_cleanup!(*_)
|
|
287
308
|
SearchEngine::Schema.prune_history!(self)
|
|
288
309
|
rescue StandardError
|
data/lib/search_engine/errors.rb
CHANGED
|
@@ -127,6 +127,23 @@ module SearchEngine
|
|
|
127
127
|
# leaving those partitions unindexed.
|
|
128
128
|
class PartitionTimeout < Error; end
|
|
129
129
|
|
|
130
|
+
# Raised inside a {SearchEngine::Schema.apply!} block when indexation
|
|
131
|
+
# returns a non-ok status. Aborting the block prevents the alias swap,
|
|
132
|
+
# keeping the previous (fully-indexed) physical collection active.
|
|
133
|
+
#
|
|
134
|
+
# The partially-indexed new physical is left intact for inspection.
|
|
135
|
+
class IndexationAborted < Error
|
|
136
|
+
# @return [Hash] the indexation result hash (:status, :docs_total, etc.)
|
|
137
|
+
attr_reader :result
|
|
138
|
+
|
|
139
|
+
# @param result [Hash]
|
|
140
|
+
def initialize(result)
|
|
141
|
+
@result = result
|
|
142
|
+
msg = result.is_a?(Hash) ? (result[:sample_error] || 'indexation failed') : 'indexation failed'
|
|
143
|
+
super(msg)
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
130
147
|
# Raised for network-level connectivity issues prior to receiving a response.
|
|
131
148
|
#
|
|
132
149
|
# Examples: DNS resolution failures, refused TCP connections, TLS handshake
|
|
@@ -80,10 +80,16 @@ module SearchEngine
|
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
# Whether an HTTP status code represents a transient/retryable error.
|
|
83
|
+
#
|
|
84
|
+
# Includes 404 to handle brief unavailability of freshly-created
|
|
85
|
+
# collections during blue/green schema applies (Typesense cluster
|
|
86
|
+
# propagation delay). A genuinely missing collection will still fail
|
|
87
|
+
# after exhausting the retry budget.
|
|
88
|
+
#
|
|
83
89
|
# @param code [Integer]
|
|
84
90
|
# @return [Boolean]
|
|
85
91
|
def self.transient_status?(code)
|
|
86
|
-
code == 429 || (code >= 500 && code <= 599)
|
|
92
|
+
code == 404 || code == 429 || (code >= 500 && code <= 599)
|
|
87
93
|
end
|
|
88
94
|
|
|
89
95
|
private
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: search-engine-for-typesense
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 30.1.6.
|
|
4
|
+
version: 30.1.6.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nikita Shkoda
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-03-
|
|
11
|
+
date: 2026-03-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: concurrent-ruby
|