避免重平衡
This commit is contained in:
parent
cd54024a42
commit
e88c357d88
2
app.py
2
app.py
@ -27,7 +27,7 @@ def handler_userid(properties):
|
|||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
post_data = PostData()
|
post_data = PostData(client)
|
||||||
schedule.every(60).seconds.do(post_data.post)
|
schedule.every(60).seconds.do(post_data.post)
|
||||||
idx = get_data_id()
|
idx = get_data_id()
|
||||||
|
|
||||||
|
@ -14,8 +14,9 @@ requests.packages.urllib3.disable_warnings()
|
|||||||
|
|
||||||
|
|
||||||
class PostData:
|
class PostData:
|
||||||
def __init__(self):
|
def __init__(self, kafka_client):
|
||||||
self.data_list = []
|
self.data_list = []
|
||||||
|
self.kafka_client = kafka_client
|
||||||
|
|
||||||
def add(self, data):
|
def add(self, data):
|
||||||
self.data_list.append(data)
|
self.data_list.append(data)
|
||||||
@ -53,6 +54,7 @@ class PostData:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
finally:
|
finally:
|
||||||
|
self.kafka_client.commit()
|
||||||
self.set_idx()
|
self.set_idx()
|
||||||
self.clear_data()
|
self.clear_data()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user