|
@@ -71,3 +71,33 @@ def find_holes(messages: List[Message], accepted_max: int = 1_000_000) -> List[H
|
71
|
71
|
end_message=sequence.start_message
|
72
|
72
|
))
|
73
|
73
|
return holes
|
|
74
|
+
|
|
75
|
+def find_holesV2(messages: List[Message]) -> List[Hole]:
|
|
76
|
+ current = 1
|
|
77
|
+ msg_idx = 0
|
|
78
|
+ threshold = 1000
|
|
79
|
+
|
|
80
|
+ result = []
|
|
81
|
+
|
|
82
|
+ while True:
|
|
83
|
+ msgCurrent = next((m for m in messages if m.get_counted_value() == current), None)
|
|
84
|
+ if msgCurrent:
|
|
85
|
+ if len(result) > 0 and result[-1].end < 1:
|
|
86
|
+ result[-1].end = current-1
|
|
87
|
+ result[-1].end_message = msgCurrent
|
|
88
|
+
|
|
89
|
+ messages.remove(msgCurrent)
|
|
90
|
+ current += 1
|
|
91
|
+ else:
|
|
92
|
+ if len(result) == 0 or result[-1].end > 0:
|
|
93
|
+ hole = Hole(
|
|
94
|
+ start = current,
|
|
95
|
+ end = 0,
|
|
96
|
+ start_message = Message(sender_name='',timestamp_ms=0),
|
|
97
|
+ end_message = Message(sender_name='',timestamp_ms=0)
|
|
98
|
+ )
|
|
99
|
+ result.append(hole)
|
|
100
|
+ elif current - result[-1].start > threshold:
|
|
101
|
+ break
|
|
102
|
+
|
|
103
|
+ return result
|