Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for #378 #380

Merged
merged 3 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions faust/transport/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ def _new_offset(self, tp: TP) -> Optional[int]:
# self._committed_offset[tp] is 31
# the return value will be None (the same as 31)
if self._committed_offset[tp]:
if min(acked) - self._committed_offset[tp] > 0:
if min(acked) - self._committed_offset[tp] > 1:
return None

# Note: acked is always kept sorted.
Expand Down Expand Up @@ -1189,7 +1189,7 @@ async def _drain_messages(self, fetcher: ServiceT) -> None: # pragma: no cover
if gap > 1 and r_offset:
acks_enabled = acks_enabled_for(message.topic)
if acks_enabled:
await self._add_gap(tp, r_offset, offset)
await self._add_gap(tp, r_offset + 1, offset)
if commit_every is not None:
if self._n_acked >= commit_every:
self._n_acked = 0
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/transport/test_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,8 @@ def test_new_offset(self, tp, acked, expected_offset, expected_acked, *, consume
IntervalTree([Interval(2, 3), Interval(5, 6), Interval(9, 10)]),
11,
),
(TP1, [3, 4], IntervalTree(), None),
(TP1, [3, 4], IntervalTree([Interval(2, 3)]), 5),
],
)
def test_new_offset_with_gaps(self, tp, acked, gaps, expected_offset, *, consumer):
Expand Down