search-engine-for-typesense 30.1.8.19 → 30.1.8.20
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: 0ee014706c77ccb6794d31e57efbc2e2efe3f5dd167e18adb2ada205678fdea1
|
|
4
|
+
data.tar.gz: 11544aa9e90f22be02e65df7e848c4a66ef452f544e9f9ee0ea84ba9dfe31871
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 40d1c46d229a68f0f04402d3fed7ea62fa68d91d76bb92096e2062667518c68f19cf32d5ed3155140c304a38328714e19fd718f950f21cd6f1f890848c827075
|
|
7
|
+
data.tar.gz: 6e4e43fd5ca84f0f53ba3cc8a06d1dc2eadd43be935b54f4bdc2fcd7aef38e1c860a6e37c38cd73acdf1c4a8683d769bc4a58e80bd0ab3f356eed4de37e393e7
|
|
@@ -38,10 +38,10 @@ module SearchEngine
|
|
|
38
38
|
# @return [void]
|
|
39
39
|
def perform(collection_class_name, partition, into: nil, metadata: {}, run_id: nil, partition_key: nil)
|
|
40
40
|
payload = nil
|
|
41
|
-
klass = constantize_collection!(collection_class_name)
|
|
42
|
-
payload = base_payload(klass, partition: partition, into: into)
|
|
43
41
|
run_store = indexing_run_store(run_id)
|
|
44
42
|
partition_key ||= SearchEngine::IndexingRun.partition_key(partition) if run_id
|
|
43
|
+
klass = constantize_collection!(collection_class_name)
|
|
44
|
+
payload = base_payload(klass, partition: partition, into: into)
|
|
45
45
|
run_store&.mark_started(run_id: run_id, partition_key: partition_key, job_id: job_id)
|
|
46
46
|
instrument_event('search_engine.dispatcher.job_started',
|
|
47
47
|
payload.merge(queue: queue_name, job_id: job_id, metadata: metadata)
|
|
@@ -62,10 +62,26 @@ module SearchEngine
|
|
|
62
62
|
)
|
|
63
63
|
)
|
|
64
64
|
nil
|
|
65
|
+
rescue SearchEngine::IndexingRunStore::StaleRun => error
|
|
66
|
+
safe_payload = payload || error_payload(error)
|
|
67
|
+
instrument_stale_run(error, payload: safe_payload.merge(metadata: metadata || {}), run_id: run_id,
|
|
68
|
+
partition_key: partition_key)
|
|
69
|
+
nil
|
|
65
70
|
rescue StandardError => error
|
|
66
71
|
safe_payload = payload || error_payload(error)
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
safe_payload = safe_payload.merge(metadata: metadata || {})
|
|
73
|
+
if retryable_error?(error)
|
|
74
|
+
instrument_error(error, payload: safe_payload)
|
|
75
|
+
raise
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
if run_id && run_store
|
|
79
|
+
mark_failed_for_run(run_store, run_id, partition_key, error, payload: safe_payload)
|
|
80
|
+
instrument_error(error, payload: safe_payload)
|
|
81
|
+
return nil
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
instrument_error(error, payload: safe_payload)
|
|
69
85
|
raise
|
|
70
86
|
end
|
|
71
87
|
|
|
@@ -149,6 +165,19 @@ module SearchEngine
|
|
|
149
165
|
)
|
|
150
166
|
end
|
|
151
167
|
|
|
168
|
+
def instrument_stale_run(error, payload:, run_id:, partition_key:)
|
|
169
|
+
instrument_error(
|
|
170
|
+
error,
|
|
171
|
+
payload: payload.merge(discarded: true, run_id: run_id, partition_key: partition_key)
|
|
172
|
+
)
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def mark_failed_for_run(run_store, run_id, partition_key, error, payload:)
|
|
176
|
+
run_store.mark_failed(run_id: run_id, partition_key: partition_key, error: error)
|
|
177
|
+
rescue SearchEngine::IndexingRunStore::StaleRun => stale_error
|
|
178
|
+
instrument_stale_run(stale_error, payload: payload, run_id: run_id, partition_key: partition_key)
|
|
179
|
+
end
|
|
180
|
+
|
|
152
181
|
def instrument_event(event, payload)
|
|
153
182
|
SearchEngine::Instrumentation.instrument(event, payload) {}
|
|
154
183
|
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'search_engine/indexing_run'
|
|
4
|
+
require 'search_engine/indexing_run_store'
|
|
4
5
|
|
|
5
6
|
module SearchEngine
|
|
6
7
|
module IndexingRunStore
|
|
@@ -139,15 +140,15 @@ module SearchEngine
|
|
|
139
140
|
|
|
140
141
|
def update_partition(run_id, partition_key)
|
|
141
142
|
meta = symbolize_meta(@cache.read(meta_cache_key(run_id)))
|
|
142
|
-
raise
|
|
143
|
+
raise StaleRun, "indexing run not found: #{run_id}" unless meta
|
|
143
144
|
|
|
144
145
|
partition_key = partition_key.to_s
|
|
145
146
|
unless Array(meta[:partition_keys]).map(&:to_s).include?(partition_key)
|
|
146
|
-
raise
|
|
147
|
+
raise StaleRun, "indexing run partition not found: #{partition_key}"
|
|
147
148
|
end
|
|
148
149
|
|
|
149
150
|
entry = @cache.read(partition_cache_key(run_id, partition_key))
|
|
150
|
-
raise
|
|
151
|
+
raise StaleRun, "indexing run partition not found: #{partition_key}" unless entry
|
|
151
152
|
|
|
152
153
|
entry = deep_symbolize(entry)
|
|
153
154
|
yield entry
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
module SearchEngine
|
|
4
4
|
# Resolver and interface contract for async partition indexing run stores.
|
|
5
5
|
module IndexingRunStore
|
|
6
|
+
# Raised by run stores when a coordinated partition job belongs to a run
|
|
7
|
+
# that should no longer execute.
|
|
8
|
+
class StaleRun < StandardError; end
|
|
9
|
+
|
|
6
10
|
module_function
|
|
7
11
|
|
|
8
12
|
# Resolve a configured store or the Rails.cache-backed default.
|
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.8.
|
|
4
|
+
version: 30.1.8.20
|
|
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-07-
|
|
11
|
+
date: 2026-07-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: concurrent-ruby
|