File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
confluent_kafka/kafkatest Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -275,6 +275,8 @@ def to_dict(self):
275
275
vc .consumer .subscribe (args ['topic' ],
276
276
on_assign = vc .on_assign , on_revoke = vc .on_revoke )
277
277
278
+ failed = False
279
+
278
280
try :
279
281
while vc .run :
280
282
msg = vc .consumer .poll (timeout = 1.0 )
@@ -295,13 +297,22 @@ def to_dict(self):
295
297
vc .run = False
296
298
pass
297
299
300
+ except Exception as e :
301
+ vc .dbg ('Terminating on exception: %s' % str (e ))
302
+ failed = True
303
+
298
304
vc .dbg ('Closing consumer' )
299
305
vc .send_records_consumed (immediate = True )
300
- if not vc .use_auto_commit :
301
- vc .do_commit (immediate = True , asynchronous = False )
302
306
303
- vc .consumer .close ()
307
+ if not failed :
308
+ try :
309
+ if not vc .use_auto_commit :
310
+ vc .do_commit (immediate = True , asynchronous = False )
311
+ vc .consumer .close ()
312
+ except Exception as e :
313
+ vc .dbg ('Ignoring exception while closing: %s' % str (e ))
314
+ failed = True
304
315
305
- vc .send ({'name' : 'shutdown_complete' })
316
+ vc .send ({'name' : 'shutdown_complete' , 'failed' : failed })
306
317
307
318
vc .dbg ('All done' )
You can’t perform that action at this time.
0 commit comments