Skip to content

Commit 84b442d

Browse files
authored
fix: align FDv2 goodbye event with spec (reason-only) (#422)
1 parent 1c700b4 commit 84b442d

4 files changed

Lines changed: 5 additions & 16 deletions

File tree

ldclient/impl/datasourcev2/streaming.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -289,12 +289,7 @@ def _process_message(
289289

290290
if msg.event == EventName.GOODBYE:
291291
goodbye = Goodbye.from_dict(json.loads(msg.data))
292-
if not goodbye.silent:
293-
log.error(
294-
"SSE server received error: %s (%s)",
295-
goodbye.reason,
296-
goodbye.catastrophe,
297-
)
292+
log.info("SSE server sent goodbye: %s", goodbye.reason)
298293

299294
return None
300295

ldclient/impl/datasystem/protocolv2.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,13 @@ class Goodbye:
120120
"""
121121

122122
reason: str
123-
silent: bool
124-
catastrophe: bool
125123

126124
def to_dict(self) -> dict:
127125
"""
128126
Serializes the Goodbye to a JSON-compatible dictionary.
129127
"""
130128
return {
131129
"reason": self.reason,
132-
"silent": self.silent,
133-
"catastrophe": self.catastrophe,
134130
}
135131

136132
@staticmethod
@@ -139,13 +135,11 @@ def from_dict(data: dict) -> "Goodbye":
139135
Deserializes a Goodbye event from a JSON-compatible dictionary.
140136
"""
141137
reason = data.get("reason")
142-
silent = data.get("silent")
143-
catastrophe = data.get("catastrophe")
144138

145-
if reason is None or silent is None or catastrophe is None:
139+
if reason is None:
146140
raise ValueError("Missing required fields in Goodbye JSON.")
147141

148-
return Goodbye(reason=reason, silent=silent, catastrophe=catastrophe)
142+
return Goodbye(reason=reason)
149143

150144

151145
@dataclass(frozen=True)

ldclient/testing/impl/datasourcev2/test_polling_synchronizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def events() -> dict:
7878
data=json.dumps(selector.to_dict()),
7979
)
8080

81-
goodbye = Goodbye(reason="test reason", silent=True, catastrophe=False)
81+
goodbye = Goodbye(reason="test reason")
8282
goodbye_event = Event(
8383
event=EventName.GOODBYE,
8484
data=json.dumps(goodbye.to_dict()),

ldclient/testing/impl/datasourcev2/test_streaming_synchronizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def events() -> dict:
156156
data=json.dumps(selector.to_dict()),
157157
)
158158

159-
goodbye = Goodbye(reason="test reason", silent=True, catastrophe=False)
159+
goodbye = Goodbye(reason="test reason")
160160
goodbye_event = Event(
161161
event=EventName.GOODBYE,
162162
data=json.dumps(goodbye.to_dict()),

0 commit comments

Comments
 (0)