From 8fb94cf15f6658be54994d18a85517145ee9c3ca Mon Sep 17 00:00:00 2001 From: Bob Gregory Date: Sat, 13 Apr 2019 17:19:50 +0100 Subject: [PATCH] Ugly type switch for Position --- photonpump/messages.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/photonpump/messages.py b/photonpump/messages.py index f354155..e151a03 100644 --- a/photonpump/messages.py +++ b/photonpump/messages.py @@ -400,7 +400,8 @@ def dump(*chunks: bytearray): def _make_event(record: messages_pb2.ResolvedEvent): - if record.HasField("commit_position"): + + if type(record) == messages_pb2.ResolvedEvent: position = Position(record.commit_position, record.prepare_position) else: position = None