优化价格同步

This commit is contained in:
shenjian@fangjia.com
2022-10-18 15:15:38 +08:00
parent ff375e1012
commit 959d320baa
3 changed files with 159 additions and 5 deletions
+4 -2
View File
@@ -36,8 +36,10 @@ def sync(city=None):
# 加载库中均价数据
community_summary_df = es206_client.scan_by_sql_to_data_frame("SELECT city, region, name, avg_price FROM community_summary")
with ThreadPoolExecutor(30) as pool:
with ThreadPoolExecutor(50) as pool:
def deal(index, item):
if index % 1000 == 0:
log.info("已处理" + str(index))
curr_city = item['city']
curr_region = item['region']
curr_name = item['name']
@@ -82,7 +84,7 @@ def sync(city=None):
try:
helpers.bulk(es206_client.elastic_client, actions)
count += len(actions)
print("更新:" + str(count))
print("已更新:" + str(count))
except Exception as e:
print(e)
actions.clear()