@@ -1124,7 +1124,7 @@ def _update_fetch_positions(self, timeout_ms=None):
11241124 partitions (List[TopicPartition]): The partitions that need
11251125 updating fetch positions.
11261126
1127- Returns True if fetch positions updated, False if timeout
1127+ Returns True if fetch positions updated, False if timeout or async reset is pending
11281128
11291129 Raises:
11301130 NoOffsetForPartitionError: If no offset is stored for a given
@@ -1135,15 +1135,13 @@ def _update_fetch_positions(self, timeout_ms=None):
11351135
11361136 if (self .config ['api_version' ] >= (0 , 8 , 1 ) and
11371137 self .config ['group_id' ] is not None ):
1138- try :
1139- # If there are any partitions which do not have a valid position and are not
1140- # awaiting reset, then we need to fetch committed offsets. We will only do a
1141- # coordinator lookup if there are partitions which have missing positions, so
1142- # a consumer with manually assigned partitions can avoid a coordinator dependence
1143- # by always ensuring that assigned partitions have an initial position.
1144- self ._coordinator .refresh_committed_offsets_if_needed (timeout_ms = timeout_ms )
1145- except KafkaTimeoutError :
1146- pass
1138+ # If there are any partitions which do not have a valid position and are not
1139+ # awaiting reset, then we need to fetch committed offsets. We will only do a
1140+ # coordinator lookup if there are partitions which have missing positions, so
1141+ # a consumer with manually assigned partitions can avoid a coordinator dependence
1142+ # by always ensuring that assigned partitions have an initial position.
1143+ if not self ._coordinator .refresh_committed_offsets_if_needed (timeout_ms = timeout_ms ):
1144+ return False
11471145
11481146 # If there are partitions still needing a position and a reset policy is defined,
11491147 # request reset using the default policy. If no reset strategy is defined and there
@@ -1152,8 +1150,7 @@ def _update_fetch_positions(self, timeout_ms=None):
11521150
11531151 # Finally send an asynchronous request to lookup and update the positions of any
11541152 # partitions which are awaiting reset.
1155- self ._fetcher .reset_offsets_if_needed ()
1156- return False
1153+ return not self ._fetcher .reset_offsets_if_needed ()
11571154
11581155 def _message_generator_v2 (self ):
11591156 timeout_ms = 1000 * max (0 , self ._consumer_timeout - time .time ())
0 commit comments