From 132f6cdb5ca08e5e1e4afce127e85ff4bccf1fcf Mon Sep 17 00:00:00 2001 From: wuaho Date: Mon, 2 Aug 2021 13:37:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=81=9C=E6=AD=A2=E5=85=A5=E5=BA=93=E4=BF=A1?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 9 +++++++++ settings.py | 2 ++ 2 files changed, 11 insertions(+) diff --git a/app.py b/app.py index 6424826..56aa02d 100644 --- a/app.py +++ b/app.py @@ -47,6 +47,15 @@ class XProcess(Process): # continue obj = getattr(handler_event, type_) obj(msg) + elif type_ == settings.STOP_SIGNAL: + # 停止消费kafka + print(f'进程{self.partition} 等待90秒') + time.sleep(90) + print(f'进程{self.partition} 写入数据') + transmitter.run() + print(f'进程{self.partition} 结束') + + break else: continue diff --git a/settings.py b/settings.py index df0c107..40c0a60 100644 --- a/settings.py +++ b/settings.py @@ -29,6 +29,8 @@ class Config: 'decode_responses': True } + STOP_SIGNAL = 'stop_MntxuXMc' + class Debug(Config): pass