修复BUG

This commit is contained in:
sjshenjian
2024-11-27 16:33:40 +08:00
parent 1cd5079ac4
commit db8cbf0edb
+5 -4
View File
@@ -11,7 +11,8 @@ from threading import Lock
mutex = Lock()
log = logging.getLogger(__name__)
es206_client = ElasticSearchClient(host='192.168.0.89', username='elastic', password='elasticsearch')
es206_client = ElasticSearchClient(host='192.168.0.206')
es89_client = ElasticSearchClient(host='192.168.0.89', username='elastic', password='elasticsearch')
tmp_ck = ClickHouseClient(database='tmp')
index_name = "community_summary"
@@ -114,7 +115,7 @@ def sync(city=None):
log.info("开始同步消费数据...")
tmp_sql = f"select * from community_summary "
if pd.notna(city):
tmp_sql += f" where city='{city}'"
tmp_sql += f" where city='{city}' "
seaweed_df = tmp_ck.read_sql_query(tmp_sql)
seaweed_list = list()
@@ -143,12 +144,12 @@ def sync(city=None):
actions.append(action)
if len(actions) == 5000:
helpers.bulk(es206_client.elastic_client, actions)
helpers.bulk(es89_client.elastic_client, actions)
count += len(actions)
log.info("更新:" + str(count))
actions.clear()
if len(actions) > 0:
helpers.bulk(es206_client.elastic_client, actions)
helpers.bulk(es89_client.elastic_client, actions)
actions.clear()
log.info("完成同步消费数据...")