新增锁
This commit is contained in:
@@ -8,6 +8,10 @@ from elasticsearch import helpers
|
||||
import numpy as np
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
import sys
|
||||
import threading
|
||||
|
||||
# 创建线程锁
|
||||
lock = threading.Lock()
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
es206_client = ElasticSearchClient(host='192.168.0.206')
|
||||
@@ -83,6 +87,7 @@ def find_around_price_item(seaweed_df, index, item):
|
||||
print(lat)
|
||||
print(price)
|
||||
print(index)
|
||||
lock.acquire()
|
||||
if pd.notna(price):
|
||||
seaweed_df.loc[index, 'avg_cost'] = int(price)
|
||||
if item['_id'] == '50bd172ae4b0fbe60a6fe628':
|
||||
@@ -90,6 +95,7 @@ def find_around_price_item(seaweed_df, index, item):
|
||||
print(seaweed_df.loc[index])
|
||||
else:
|
||||
seaweed_df.loc[index, 'avg_cost'] = None
|
||||
lock.release()
|
||||
if item['_id'] == '50bd172ae4b0fbe60a6fe628':
|
||||
print(seaweed_df.loc[index])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user