File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -83,12 +83,13 @@ def fetch_last_known_offsets(self, partitions=None):
83
83
if not partitions :
84
84
partitions = self .client .get_partition_ids_for_topic (self .topic )
85
85
86
- for partition in partitions :
87
- (resp ,) = self .client .send_offset_fetch_request (
88
- self .group ,
89
- [OffsetFetchRequest (self .topic , partition )],
90
- fail_on_error = False
91
- )
86
+ responses = self .client .send_offset_fetch_request (
87
+ self .group ,
88
+ [OffsetFetchRequest (self .topic , p ) for p in partitions ],
89
+ fail_on_error = False
90
+ )
91
+
92
+ for resp in responses :
92
93
try :
93
94
check_error (resp )
94
95
# API spec says server wont set an error here
@@ -98,12 +99,12 @@ def fetch_last_known_offsets(self, partitions=None):
98
99
99
100
# -1 offset signals no commit is currently stored
100
101
if resp .offset == - 1 :
101
- self .offsets [partition ] = 0
102
+ self .offsets [resp . partition ] = 0
102
103
103
104
# Otherwise we committed the stored offset
104
105
# and need to fetch the next one
105
106
else :
106
- self .offsets [partition ] = resp .offset
107
+ self .offsets [resp . partition ] = resp .offset
107
108
108
109
def commit (self , partitions = None ):
109
110
"""
You can’t perform that action at this time.
0 commit comments