dionysus-rb 1.7.1 → 1.7.2
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 +4 -0
- data/Gemfile.lock +1 -1
- data/lib/dionysus/producer/embedded_timestamp_repair.rb +8 -4
- data/lib/dionysus/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: aa2a7b59427b64a4c359cc5fdbd62b39713588cf9029e4416e3e728a2f4445be
|
|
4
|
+
data.tar.gz: 06afd203be36e3a123496add489ba30552ae6497b512f969de3209f0f9f5b8c1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0c9ae06fe4831be2015c68806e237f1244fbecdbde5eb1948f6b01b6da8578764b8a231a087683809d229bee5af3a7821a5e64a53f548bcf512077828423f38b
|
|
7
|
+
data.tar.gz: c789df4b0fb8f28c208a8cd460161a42bf34f6fc1e29d61d280c2c5092e8a832e66144d7ea15b5abe351b3c08cdf4ffbf08fb18c6412f050a2326b71593642dc
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.7.2]
|
|
4
|
+
- Read the payload by either key form. 1.7.1 looked up `id` and `updated_at` as string keys, but a serializer may key its payload with symbols, so `repairable?` was false on every publish and the class stayed a silent no-op.
|
|
5
|
+
|
|
6
|
+
|
|
3
7
|
## [1.7.1]
|
|
4
8
|
- Parse an ISO8601 string timestamp in the payload instead of ignoring it. 1.7.0 required every timestamp to answer `acts_like_time?`, so a serializer that renders the parent's `updated_at` as a string made the whole class a silent no-op: the parent never looked time-like, no payload was ever examined, no row was ever corrected and `dionysus.publish.timestamp_repair` never fired.
|
|
5
9
|
|
data/Gemfile.lock
CHANGED
|
@@ -44,7 +44,7 @@ class Dionysus::Producer::EmbeddedTimestampRepair
|
|
|
44
44
|
def repaired?(record, record_payload)
|
|
45
45
|
return false unless repairable?(record, record_payload)
|
|
46
46
|
|
|
47
|
-
published_at = coerce_time(record_payload
|
|
47
|
+
published_at = coerce_time(attribute(record_payload, TIMESTAMP_ATTRIBUTE))
|
|
48
48
|
latest = embedded_timestamps(record_payload).max
|
|
49
49
|
return false unless published_at && latest && latest > published_at
|
|
50
50
|
|
|
@@ -63,7 +63,7 @@ class Dionysus::Producer::EmbeddedTimestampRepair
|
|
|
63
63
|
|
|
64
64
|
def repairable?(record, record_payload)
|
|
65
65
|
record.is_a?(ActiveRecord::Base) && record.persisted? &&
|
|
66
|
-
record_payload.is_a?(Hash) && record_payload
|
|
66
|
+
record_payload.is_a?(Hash) && attribute(record_payload, PRIMARY_KEY_ATTRIBUTE) == record.id
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
def embedded_timestamps(record_payload)
|
|
@@ -71,7 +71,7 @@ class Dionysus::Producer::EmbeddedTimestampRepair
|
|
|
71
71
|
Array.wrap(value).filter_map do |embedded|
|
|
72
72
|
next unless embedded.is_a?(Hash)
|
|
73
73
|
|
|
74
|
-
coerce_time(embedded
|
|
74
|
+
coerce_time(attribute(embedded, TIMESTAMP_ATTRIBUTE))
|
|
75
75
|
end
|
|
76
76
|
end
|
|
77
77
|
end
|
|
@@ -81,7 +81,11 @@ class Dionysus::Producer::EmbeddedTimestampRepair
|
|
|
81
81
|
tags: ["model:#{record.class}", "outcome:#{updated.zero? ? "stale_read" : "row_behind"}"])
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
-
# A serializer may render the timestamp it is about to publish
|
|
84
|
+
# A serializer may key its payload either way, and may render the timestamp it is about to publish.
|
|
85
|
+
def attribute(record_payload, name)
|
|
86
|
+
record_payload.key?(name) ? record_payload[name] : record_payload[name.to_sym]
|
|
87
|
+
end
|
|
88
|
+
|
|
85
89
|
def coerce_time(value)
|
|
86
90
|
case value
|
|
87
91
|
when ActiveSupport::TimeWithZone, Time then value
|
data/lib/dionysus/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dionysus-rb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.7.
|
|
4
|
+
version: 1.7.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Karol Galanciak
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
11
|
+
date: 2026-09-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|