Skip to content

Commit

Permalink
Merge pull request #40 from ah-/fix_punctuate_with_same_ts
Browse files Browse the repository at this point in the history
Fix punctuate with same timestamp
  • Loading branch information
ah- committed Dec 21, 2017
2 parents 87728e2 + de285d9 commit 1b5d75d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions tests/processor/test_punctuation_queue.py
Expand Up @@ -23,3 +23,10 @@ def test_punctuation_queue():
assert len(punctuations) == 2

assert punctuations == [('node', 0), ('node', 100)]


def test_punctuation_schedule_can_compare_entires_with_same_timestamp():
schedule1 = punctuation_queue.PunctuationSchedule(123, {}, 100)
schedule2 = punctuation_queue.PunctuationSchedule(123, {}, 100)

assert not schedule1 < schedule2
4 changes: 3 additions & 1 deletion winton_kafka_streams/processor/_punctuation_queue.py
Expand Up @@ -2,7 +2,9 @@
from collections import namedtuple


PunctuationSchedule = namedtuple('PunctuationSchedule', ['timestamp', 'node', 'interval'])
class PunctuationSchedule(namedtuple('PunctuationSchedule', ['timestamp', 'node', 'interval'])):
def __lt__(self, other):
return self.timestamp < other.timestamp


class PunctuationQueue:
Expand Down

0 comments on commit 1b5d75d

Please sign in to comment.