Skip to content

Commit

Permalink
add even more additional sorting to stabilize remove stale segments
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsofbits committed Jul 15, 2022
1 parent 85231e7 commit 16864b9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gpsdio_segment/segmenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,12 @@ def _remove_excess_segments(self):
# Remove oldest segment
segs = list(self._segments.items())
segs.sort(
key=lambda x: (x[1].last_msg["timestamp"], x[1].last_msg["msgid"])
key=lambda x: (
x[1].last_msg["timestamp"],
x[1].last_msg["msgid"],
x[1].last_msg["course"],
x[1].last_msg["speed"],
)
)
stalest_seg_id, _ = segs[0]
log("Removing stale segment {}".format(stalest_seg_id))
Expand Down

0 comments on commit 16864b9

Please sign in to comment.