提交 9f5a4064 编写于 作者: W wenzhouwww@live.cn

update

上级 7602e579
......@@ -2039,7 +2039,7 @@ class TdSuperTable:
conf.set("enable.auto.commit", "true")
def tmq_commit_cb_print(tmq, resp, offset, param=None):
print(f"commit: {resp}, tmq: {tmq}, offset: {offset}, param: {param}")
conf.set_auto_commit_cb(tmq_commit_cb_print, None)
# conf.set_auto_commit_cb(tmq_commit_cb_print, None)
consumer = conf.new_consumer()
topic_list = TaosTmqList()
for topic in current_topic_list:
......@@ -2049,13 +2049,12 @@ class TdSuperTable:
except TmqError as e :
pass
# consumer work only 30 sec
# consumer with random work life
time_start = time.time()
while 1:
res = consumer.poll(1000)
if time.time() - time_start >5 :
if time.time() - time_start >random.randint(5,50) :
break
# time.sleep(10)
try:
consumer.unsubscribe()
except TmqError as e :
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册