search-engine-for-typesense 30.1.8.15 → 30.1.8.16
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 +4 -4
- data/lib/search_engine/postgres_outbox/repository.rb +29 -6
- data/lib/search_engine/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fd4cd9a02cea20dbf913f71c55c1ae57b77d29245be9e1f02e93a22e791cadcf
|
|
4
|
+
data.tar.gz: 404f2b78d290227c1fdfcd0b82cfcd7d41f4ec353d5e551a20658cd9a78ff593
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 166cb097643cfb4376a1232eaab0e4f371fd1b3c409a9103f2a3d812dd1ba74f9812e13986e542abcbd086fe4cdcf05db3bca799ddaac2e5ee94215db5d83098
|
|
7
|
+
data.tar.gz: 5a57d41c35a28022ca8384f8f7924b5d26e7210ac3a3681ccc8a9dcfaf7cba90ba5db6ea3914d09d2f9c19efa6fe43947778a086ecafc13fddc0a4ab1e751d5e
|
|
@@ -112,7 +112,7 @@ module SearchEngine
|
|
|
112
112
|
# Create missing delivery rows for all configured delivery targets.
|
|
113
113
|
# @return [void]
|
|
114
114
|
def materialize_deliveries!(limit: SearchEngine.config.postgres_outbox.batch_size)
|
|
115
|
-
targets =
|
|
115
|
+
targets = materialization_delivery_targets
|
|
116
116
|
return if targets.empty?
|
|
117
117
|
|
|
118
118
|
rows = []
|
|
@@ -271,8 +271,10 @@ module SearchEngine
|
|
|
271
271
|
WITH target(target_key, queue_name) AS (
|
|
272
272
|
VALUES #{delivery_target_values_sql(targets)}
|
|
273
273
|
),
|
|
274
|
-
candidate_events AS (
|
|
275
|
-
SELECT outbox
|
|
274
|
+
candidate_events AS MATERIALIZED (
|
|
275
|
+
SELECT outbox.id,
|
|
276
|
+
outbox.collection,
|
|
277
|
+
outbox.document_id
|
|
276
278
|
FROM #{quoted_table} outbox
|
|
277
279
|
WHERE outbox.status IN ('pending', 'processing', 'failed')
|
|
278
280
|
AND (outbox.next_attempt_at IS NULL OR outbox.next_attempt_at <= CURRENT_TIMESTAMP)
|
|
@@ -289,10 +291,24 @@ module SearchEngine
|
|
|
289
291
|
ORDER BY outbox.id ASC
|
|
290
292
|
LIMIT #{limit}
|
|
291
293
|
FOR UPDATE SKIP LOCKED
|
|
294
|
+
),
|
|
295
|
+
latest_candidate_ids AS (
|
|
296
|
+
SELECT id
|
|
297
|
+
FROM (
|
|
298
|
+
SELECT id,
|
|
299
|
+
ROW_NUMBER() OVER (
|
|
300
|
+
PARTITION BY collection, document_id
|
|
301
|
+
ORDER BY id DESC
|
|
302
|
+
) AS row_number
|
|
303
|
+
FROM candidate_events
|
|
304
|
+
) ranked_candidate_events
|
|
305
|
+
WHERE row_number = 1
|
|
292
306
|
)
|
|
293
|
-
SELECT
|
|
294
|
-
FROM
|
|
295
|
-
|
|
307
|
+
SELECT outbox.*
|
|
308
|
+
FROM #{quoted_table} outbox
|
|
309
|
+
INNER JOIN latest_candidate_ids
|
|
310
|
+
ON latest_candidate_ids.id = outbox.id
|
|
311
|
+
ORDER BY outbox.id ASC
|
|
296
312
|
SQL
|
|
297
313
|
end
|
|
298
314
|
|
|
@@ -819,6 +835,13 @@ module SearchEngine
|
|
|
819
835
|
Array(raw_targets).map { |target| DeliveryTarget.normalize(target) }
|
|
820
836
|
end
|
|
821
837
|
|
|
838
|
+
def materialization_delivery_targets
|
|
839
|
+
targets = delivery_targets
|
|
840
|
+
return targets unless delivery_mode?
|
|
841
|
+
|
|
842
|
+
targets.select { |target| target.key == target_key }
|
|
843
|
+
end
|
|
844
|
+
|
|
822
845
|
def max_attempts
|
|
823
846
|
SearchEngine.config.postgres_outbox.max_attempts.to_i
|
|
824
847
|
end
|
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.16
|
|
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-06-
|
|
11
|
+
date: 2026-06-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: concurrent-ruby
|