File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -50,9 +50,20 @@ def set_default_offset(topic, default_offset)
5050 # @param offset [Integer] the offset of the message that should be marked as processed.
5151 # @return [nil]
5252 def mark_as_processed ( topic , partition , offset )
53- @uncommitted_offsets += 1
53+ unless @group . assigned_to? ( topic , partition )
54+ @logger . debug "Not marking #{ topic } /#{ partition } :#{ offset } as processed for partition not assigned to this consumer."
55+ return
56+ end
5457 @processed_offsets [ topic ] ||= { }
5558
59+ last_processed_offset = @processed_offsets [ topic ] [ partition ] || -1
60+ if last_processed_offset > offset + 1
61+ @logger . debug "Not overwriting newer offset #{ topic } /#{ partition } :#{ last_processed_offset -1 } with older #{ offset } "
62+ return
63+ end
64+
65+ @uncommitted_offsets += 1
66+
5667 # The committed offset should always be the offset of the next message that the
5768 # application will read, thus adding one to the last message processed.
5869 @processed_offsets [ topic ] [ partition ] = offset + 1
You can’t perform that action at this time.
0 commit comments