skip some errors

This commit is contained in:
Ping Xiao 2023-05-24 19:47:56 +08:00
parent 137a9eb602
commit f2b438622a
1 changed files with 11 additions and 10 deletions

View File

@ -2043,18 +2043,19 @@ class TdSuperTable:
for topic in current_topic_list: for topic in current_topic_list:
topic_list.append(topic) topic_list.append(topic)
consumer.subscribe(topic_list)
# consumer with random work life
time_start = time.time()
while 1:
res = consumer.poll(1)
consumer.commit(res)
if time.time() - time_start > random.randint(5, 50):
break
try: try:
consumer.subscribe(topic_list)
# consumer with random work life
time_start = time.time()
while 1:
res = consumer.poll(1)
consumer.commit(res)
if time.time() - time_start > random.randint(5, 50):
break
consumer.unsubscribe() consumer.unsubscribe()
except TmqError as e: consumer.close()
except TmqError as err: # topic deleted by other threads
pass pass
return return