phlex-reactive 0.16.4 → 0.16.5
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/CHANGELOG.md +18 -1
- data/lib/phlex/reactive/presence/transport.rb +16 -5
- data/lib/phlex/reactive/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: 69a1ca18807351dc48163f7d39a945a00d7dc09c4000f78dfcb048201ddf005f
|
|
4
|
+
data.tar.gz: 3e4ffb3965adefed97fa4f384bd2a3dd7ddf8fb213385b8724eef53f702372d7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eb1f48cf92cfb846068049380ed6a2f13dd5b8b4720b422796053be6435ffb87ead4e8ee216a680823b5b9d67aeef36f95016da989abe57d885ebd4177ebf4b3
|
|
7
|
+
data.tar.gz: f52a3b225c879476a92e5d34d59d936f556edaf45a83ec1002f479086641c13dddcd8c6d8be2b7a96fca7a33230b92c1861815693a07bf4f49549f1a5714f449
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,22 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.16.5] - 2026-10-18
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **A presence component no longer raises `FrozenError` when pgbus's presence
|
|
14
|
+
settings are frozen (#427).** pgbus 0.19 and later freeze the
|
|
15
|
+
configuration's Arrays and Hashes once boot is over (an app can also freeze
|
|
16
|
+
its own Hash). `reactive_presence ..., ttl:` added its seconds to
|
|
17
|
+
`streams_presence_ttl` in place, so a component that loaded after boot
|
|
18
|
+
(`eager_load` off, the development and test default) raised
|
|
19
|
+
`can't modify frozen Hash` when that setting was a frozen Hash.
|
|
20
|
+
The ttl, and the presence stream pattern that boot registers in
|
|
21
|
+
`streams_presence_patterns`, now go through pgbus's setters as a new value.
|
|
22
|
+
The development and test pin moves to pgbus 0.20.1: from that release,
|
|
23
|
+
presence runs its SQL under the adapter's lock (zoolutions/pgbus#566).
|
|
24
|
+
|
|
9
25
|
## [0.16.4] - 2026-10-18
|
|
10
26
|
|
|
11
27
|
### Added
|
|
@@ -4227,7 +4243,8 @@ room for dogfood fixes.
|
|
|
4227
4243
|
scaffolds a reactive component (and an RSpec spec when the app uses RSpec),
|
|
4228
4244
|
state-backed by default or record-backed with `--record`.
|
|
4229
4245
|
|
|
4230
|
-
[Unreleased]: https://github.com/mhenrixon/phlex-reactive/compare/v0.16.
|
|
4246
|
+
[Unreleased]: https://github.com/mhenrixon/phlex-reactive/compare/v0.16.5...HEAD
|
|
4247
|
+
[0.16.5]: https://github.com/mhenrixon/phlex-reactive/compare/v0.16.4...v0.16.5
|
|
4231
4248
|
[0.16.4]: https://github.com/mhenrixon/phlex-reactive/compare/v0.16.3...v0.16.4
|
|
4232
4249
|
[0.16.3]: https://github.com/mhenrixon/phlex-reactive/compare/v0.16.2...v0.16.3
|
|
4233
4250
|
[0.16.2]: https://github.com/mhenrixon/phlex-reactive/compare/v0.16.1...v0.16.2
|
|
@@ -29,6 +29,10 @@ module Phlex
|
|
|
29
29
|
# is absent or does not expose the setting.
|
|
30
30
|
DEFAULT_HEARTBEAT = 15
|
|
31
31
|
|
|
32
|
+
# The Store key of the lock register_ttl holds across its read, merge
|
|
33
|
+
# and write.
|
|
34
|
+
TTL_LOCK_KEY = :phlex_reactive_presence_ttl_lock
|
|
35
|
+
|
|
32
36
|
# The change hook install! sets: the app's own hook (if any) first, then
|
|
33
37
|
# presence's. Its class is how a second install! knows it is in place.
|
|
34
38
|
ChainedHook = Data.define(:previous, :on_change) do
|
|
@@ -126,10 +130,12 @@ module Phlex
|
|
|
126
130
|
|
|
127
131
|
# At boot: auto-join presence streams, and hear their changes. An
|
|
128
132
|
# app's own change hook keeps running (chained, first).
|
|
133
|
+
# Settings change through their setters only: pgbus >= 0.19 freezes
|
|
134
|
+
# its Arrays and Hashes at boot (Configuration#finalize!).
|
|
129
135
|
def install!(on_change)
|
|
130
136
|
config = ::Pgbus.configuration
|
|
131
137
|
patterns = config.streams_presence_patterns
|
|
132
|
-
patterns
|
|
138
|
+
config.streams_presence_patterns = [*patterns, PATTERN] unless patterns.include?(PATTERN)
|
|
133
139
|
previous = config.streams_presence_on_change
|
|
134
140
|
return if previous.is_a?(ChainedHook)
|
|
135
141
|
|
|
@@ -141,11 +147,16 @@ module Phlex
|
|
|
141
147
|
# pgbus takes an Integer (every stream) or a Hash of stream name /
|
|
142
148
|
# pattern => seconds with a :default; an Integer becomes the Hash's
|
|
143
149
|
# default so the app's own setting still covers every other stream.
|
|
150
|
+
# A new Hash every time: a component can load after pgbus froze the
|
|
151
|
+
# setting at boot (eager_load off). Under a lock: two classes that
|
|
152
|
+
# load at once on two threads must each see the other's write.
|
|
144
153
|
def register_ttl(name, seconds)
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
154
|
+
Phlex::Reactive::Store.fetch(TTL_LOCK_KEY) { Mutex.new }.synchronize do
|
|
155
|
+
config = ::Pgbus.configuration
|
|
156
|
+
ttl = config.streams_presence_ttl
|
|
157
|
+
ttl = { default: ttl } unless ttl.is_a?(Hash)
|
|
158
|
+
config.streams_presence_ttl = ttl.merge(/:presence:#{Regexp.escape(name.to_s)}\z/ => seconds)
|
|
159
|
+
end
|
|
149
160
|
end
|
|
150
161
|
end
|
|
151
162
|
end
|