Skip to content

Commit 4a6a8a1

Browse files
authored
Periodic value was always default (#100)
* The periodic was not actually sent as it should, only the default value was serialized. fixing test to cover this * bump version for bug fix
1 parent 8002f7c commit 4a6a8a1

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

streaming_data_types/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Version is not directly defined in __init__ because that causes all
22
# run time dependencies to become build-time dependencies when it is
33
# imported in setup.py
4-
version = "0.26.0"
4+
version = "0.26.1"

streaming_data_types/forwarder_config_update_fc00.py

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,23 @@ def deserialise_fc00(buffer: Union[bytearray, bytes]) -> ConfigurationUpdate:
4040
stream_message = config_message.Streams(i)
4141
streams.append(
4242
StreamInfo(
43-
stream_message.Channel().decode("utf-8")
44-
if stream_message.Channel()
45-
else "",
46-
stream_message.Schema().decode("utf-8")
47-
if stream_message.Schema()
48-
else "",
49-
stream_message.Topic().decode("utf-8")
50-
if stream_message.Topic()
51-
else "",
43+
(
44+
stream_message.Channel().decode("utf-8")
45+
if stream_message.Channel()
46+
else ""
47+
),
48+
(
49+
stream_message.Schema().decode("utf-8")
50+
if stream_message.Schema()
51+
else ""
52+
),
53+
(
54+
stream_message.Topic().decode("utf-8")
55+
if stream_message.Topic()
56+
else ""
57+
),
5258
stream_message.Protocol(),
53-
int(stream_message.Periodic().decode("utf-8"))
54-
if stream_message.Periodic()
55-
else 0,
59+
stream_message.Periodic() if stream_message.Periodic() else 0,
5660
)
5761
)
5862
except flatbuffer_struct.error:
@@ -67,12 +71,14 @@ def serialise_stream(
6771
channel_offset: int,
6872
schema_offset: int,
6973
topic_offset: int,
74+
periodic_offset: int,
7075
) -> int:
7176
Stream.StreamStart(builder)
7277
Stream.StreamAddProtocol(builder, protocol)
7378
Stream.StreamAddTopic(builder, topic_offset)
7479
Stream.StreamAddSchema(builder, schema_offset)
7580
Stream.StreamAddChannel(builder, channel_offset)
81+
Stream.StreamAddPeriodic(builder, periodic_offset)
7682
return Stream.StreamEnd(builder)
7783

7884

@@ -99,7 +105,7 @@ def serialise_fc00(config_change: UpdateType, streams: List[StreamInfo]) -> byte
99105
for stream in streams
100106
]
101107
stream_offsets = [
102-
serialise_stream(builder, stream.protocol, *stream_fields)
108+
serialise_stream(builder, stream.protocol, *stream_fields, stream.periodic)
103109
for stream, stream_fields in zip(streams, stream_field_offsets)
104110
]
105111

tests/test_fc00.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def test_serialises_and_deserialises_fc00_message_with_streams_correctly(self):
3232
assert entry.config_change == original_entry["config_change"]
3333
assert stream_1 in entry.streams
3434
assert stream_2 in entry.streams
35+
assert stream_3 in entry.streams
3536

3637
def test_serialises_and_deserialises_fc00_message_without_streams_correctly(self):
3738
"""

0 commit comments

Comments
 (0)