pgbus 0.6.3 → 0.6.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 +4 -4
- data/app/helpers/pgbus/streams_helper.rb +24 -12
- data/lib/pgbus/configuration.rb +2 -1
- data/lib/pgbus/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 29a8cea3845cee18f561a257dd07a7793b44b2b7f49cdfa7cf520de2bf95cde2
|
|
4
|
+
data.tar.gz: bbc2e2bddf762b5e8add4bf5d83767afa089aaf2345fbb5c0c3f0018e8be62df
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c539792bc228074715f4903a34cfd2e84d7145d08676049dc7b8ef3ef26edc1f66f6fab8c3f5f527ca8b51e84570217d36499e810e6290fb96d1f76575e711e2
|
|
7
|
+
data.tar.gz: 20bd68684e632377de4691845bf26e92848095aa9cf528a7d401931d239b133354d491f90f32b3c294ca03240760d746624f408d50667a562062e563ce484c7e
|
|
@@ -75,22 +75,34 @@ module Pgbus
|
|
|
75
75
|
end
|
|
76
76
|
end
|
|
77
77
|
|
|
78
|
-
# Build the SSE endpoint URL
|
|
79
|
-
#
|
|
80
|
-
#
|
|
81
|
-
#
|
|
82
|
-
#
|
|
83
|
-
#
|
|
84
|
-
#
|
|
85
|
-
#
|
|
78
|
+
# Build the SSE endpoint URL for the given signed stream name.
|
|
79
|
+
#
|
|
80
|
+
# Resolution order:
|
|
81
|
+
# 1. `config.streams_path` — explicit override, useful when the
|
|
82
|
+
# engine is mounted behind an auth constraint but the SSE
|
|
83
|
+
# endpoint is mounted publicly at a separate path:
|
|
84
|
+
#
|
|
85
|
+
# # config/routes.rb
|
|
86
|
+
# authenticate :user, ->(u) { u.admin? } do
|
|
87
|
+
# mount Pgbus::Engine => "/admin/jobs"
|
|
88
|
+
# end
|
|
89
|
+
# mount Pgbus::Web::StreamApp.new => "/pgbus/streams"
|
|
90
|
+
#
|
|
91
|
+
# # config/initializers/pgbus.rb
|
|
92
|
+
# Pgbus.configure { |c| c.streams_path = "/pgbus/streams" }
|
|
93
|
+
#
|
|
94
|
+
# 2. Engine route helper — derives the path from wherever the
|
|
95
|
+
# host app mounted the engine.
|
|
96
|
+
#
|
|
97
|
+
# 3. Fallback `/pgbus/streams` — test-only context where the
|
|
98
|
+
# engine's url_helpers aren't wired in.
|
|
86
99
|
def pgbus_stream_src(signed_name)
|
|
100
|
+
base = Pgbus.configuration.streams_path
|
|
101
|
+
return "#{base.delete_suffix("/")}/#{signed_name}" if base
|
|
102
|
+
|
|
87
103
|
base = Pgbus::Engine.routes.url_helpers.streams_path
|
|
88
104
|
"#{base}/#{signed_name}"
|
|
89
105
|
rescue NameError
|
|
90
|
-
# NameError covers both uninitialized-constant (Pgbus::Engine
|
|
91
|
-
# not loaded, e.g. plain-Ruby unit specs) and NoMethodError
|
|
92
|
-
# (a NameError subclass) when the routes helper chain isn't
|
|
93
|
-
# wired in.
|
|
94
106
|
"/pgbus/streams/#{signed_name}"
|
|
95
107
|
end
|
|
96
108
|
|
data/lib/pgbus/configuration.rb
CHANGED
|
@@ -90,7 +90,7 @@ module Pgbus
|
|
|
90
90
|
:metrics_enabled
|
|
91
91
|
|
|
92
92
|
# Streams (turbo-rails replacement, SSE-based)
|
|
93
|
-
attr_accessor :streams_enabled, :streams_queue_prefix, :streams_signed_name_secret,
|
|
93
|
+
attr_accessor :streams_enabled, :streams_path, :streams_queue_prefix, :streams_signed_name_secret,
|
|
94
94
|
:streams_default_retention, :streams_retention, :streams_heartbeat_interval,
|
|
95
95
|
:streams_max_connections, :streams_idle_timeout, :streams_listen_health_check_ms,
|
|
96
96
|
:streams_write_deadline_ms, :streams_falcon_streaming_body,
|
|
@@ -168,6 +168,7 @@ module Pgbus
|
|
|
168
168
|
@metrics_enabled = true
|
|
169
169
|
|
|
170
170
|
@streams_enabled = true
|
|
171
|
+
@streams_path = nil
|
|
171
172
|
@streams_queue_prefix = "pgbus_stream"
|
|
172
173
|
@streams_signed_name_secret = nil
|
|
173
174
|
@streams_default_retention = 5 * 60 # 5 minutes
|
data/lib/pgbus/version.rb
CHANGED