search-engine-for-typesense 30.9.3 → 30.9.4

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: 8839a1d87b60901a030030a293152432bbf593b215ba7fa7292eac10e724a2bb
4
- data.tar.gz: 84b2e507deee029c7ef87165a5f5ca2f6a37450fbf25b59bb6208a42c0d4c25b
3
+ metadata.gz: 895094bd28f369deddc717d2bddb1cd6f22b9db2037a92eaa6c89f1fa1acf502
4
+ data.tar.gz: 323f746cef2f034273652af5d2c73a968660584244daa5554085bd2133afd7d2
5
5
  SHA512:
6
- metadata.gz: e0bb71bd0d9ff89f7053286c6b683433e0e49ab9e5d2cd514e2bc778f33eff821236f840b14358922afb4cc091802800616290d94a807845a87528f7f62959ff
7
- data.tar.gz: 79199d5c13cdbbc4acb8b2a5c2570e6934bd675447e5ea8d4da517f68047d3fc0060e16af69f929686b8c8ebe84e298f498e8a0b720c25bb57d1e41098700ab6
6
+ metadata.gz: 28071c461836c3818697b28296304e2f9d737289a26c87adbbd04e2df8e685590e107865518f30ca3cec1b5617ec1fdd9b4ff37822e8a7579e4f6ffc2358de7e
7
+ data.tar.gz: f70470e451f734f2c65d30b7fdc471aae831e9dabbf678f46be93901ba1ee803505b7034ef8d9338c58c312a8a9005426d75e94711f1d50485021d4553c45e72
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 30.9.4
4
+
5
+ - Wake deferred PostgreSQL outbox drains when the notification throttle expires, even when no further
6
+ notification arrives. Notification bursts do not postpone the pending wakeup.
7
+ - Preserve pending listener wakeups across reconnects and enqueue failures while keeping idle polling.
8
+ - Clarify listener fallback events and retry intervals, and restore autoloaded job constants after tests.
9
+
3
10
  ## 30.9.3
4
11
 
5
12
  - Preserve tenant filters and scoped clients across searches and bulk writes. Reject ambiguous literals,
data/README.md CHANGED
@@ -471,6 +471,13 @@ The flow is:
471
471
  truth. Run the listener in a process lifecycle you control, and keep fallback polling enabled so missed
472
472
  notifications are drained later.
473
473
 
474
+ `poll_interval_s` limits notification-driven enqueue frequency. A notification received within that
475
+ interval schedules one deferred enqueue when the interval expires; later notifications do not postpone
476
+ it. An idle listener keeps the `listener_wait_timeout_s` fallback interval (30 seconds by default).
477
+ If enqueueing fails, the deferred request survives the existing error reporting and reconnect retry.
478
+ The `search_engine.postgres_outbox.listener_fallback` event covers both idle polling and deferred
479
+ notification wakeups; its count alone does not measure missed notifications.
480
+
474
481
  PostgreSQL outbox sync is disabled by default:
475
482
 
476
483
  ```ruby
@@ -290,9 +290,9 @@ module SearchEngine
290
290
  attr_accessor :batch_sizes
291
291
  # @return [Integer] maximum processing attempts before leaving an event failed
292
292
  attr_accessor :max_attempts
293
- # @return [Integer] polling interval in seconds
293
+ # @return [Integer] notification enqueue, reconnect backoff base, and advisory-lock retry interval in seconds
294
294
  attr_accessor :poll_interval_s
295
- # @return [Integer] listener wait timeout in seconds
295
+ # @return [Integer] idle listener timeout before fallback enqueue, in seconds
296
296
  attr_accessor :listener_wait_timeout_s
297
297
  # @return [Integer] processing timeout in seconds
298
298
  attr_accessor :processing_timeout_s
@@ -13,7 +13,7 @@ module SearchEngine
13
13
  # @param drain_enqueuer [#enqueue_all, nil] enqueue coordinator for drain jobs
14
14
  # @param channel [String] PostgreSQL notification channel
15
15
  # @param wait_timeout_s [Numeric] wait timeout for LISTEN notifications
16
- # @param poll_interval_s [Numeric] fallback/retry polling interval
16
+ # @param poll_interval_s [Numeric] notification enqueue, reconnect backoff base, and advisory-lock retry interval
17
17
  # @param advisory_lock [Boolean] whether to guard this listener with a PostgreSQL advisory lock
18
18
  # @param advisory_lock_key [Integer, nil] optional explicit advisory lock key
19
19
  # @param sleeper [#call] injectable sleep hook for tests
@@ -41,6 +41,7 @@ module SearchEngine
41
41
  @stop_requested = false
42
42
  @thread = nil
43
43
  @last_enqueue_at = nil
44
+ @enqueue_pending = false
44
45
  end
45
46
 
46
47
  # Start the listener thread.
@@ -132,7 +133,7 @@ module SearchEngine
132
133
  end
133
134
 
134
135
  def wait_for_notification(connection)
135
- raw_connection(connection).wait_for_notify(wait_timeout_s) do |notify_channel, _pid, payload|
136
+ raw_connection(connection).wait_for_notify(notification_wait_timeout) do |notify_channel, _pid, payload|
136
137
  next if stop_requested?
137
138
 
138
139
  instrument(
@@ -144,6 +145,15 @@ module SearchEngine
144
145
  end
145
146
  end
146
147
 
148
+ def notification_wait_timeout
149
+ @mutex.synchronize do
150
+ next wait_timeout_s unless @enqueue_pending
151
+
152
+ remaining = @last_enqueue_at + poll_interval_s - monotonic_time
153
+ [[remaining, 0].max, wait_timeout_s].min
154
+ end
155
+ end
156
+
147
157
  def run_with_advisory_lock(connection)
148
158
  lock_key = advisory_lock_key
149
159
  acquired = advisory_lock_acquired?(connection, lock_key)
@@ -192,9 +202,11 @@ module SearchEngine
192
202
  end
193
203
 
194
204
  def enqueue_drain(force: false)
205
+ @mutex.synchronize { @enqueue_pending = true }
195
206
  return if enqueue_throttled?(force: force)
196
207
 
197
208
  drain_enqueuer.enqueue_all
209
+ @mutex.synchronize { @enqueue_pending = false }
198
210
  end
199
211
 
200
212
  def enqueue_throttled?(force:)
@@ -3,5 +3,5 @@
3
3
  module SearchEngine
4
4
  # Current gem version.
5
5
  # @return [String]
6
- VERSION = '30.9.3'
6
+ VERSION = '30.9.4'
7
7
  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.9.3
4
+ version: 30.9.4
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-11-05 00:00:00.000000000 Z
11
+ date: 2026-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby