'commit'
This commit is contained in:
@@ -213,6 +213,10 @@ async def get_station_list(d, service, uploader, max_stations_count=MAX_STATIONS
|
||||
new_stations_processed = 0
|
||||
if json_metadata.get("cards") and stations:
|
||||
for idx, card in enumerate(json_metadata["cards"]):
|
||||
# 检查是否已达到最大采集数量
|
||||
if total_processed_count >= max_stations_count:
|
||||
break
|
||||
|
||||
# 检查索引是否越界 (VL 模型可能返回的数组长度不一致)
|
||||
if idx < len(stations) and stations[idx]:
|
||||
st = stations[idx]
|
||||
@@ -391,14 +395,11 @@ async def get_station_list(d, service, uploader, max_stations_count=MAX_STATIONS
|
||||
# 记录 Redis 去重 (仅按名称去重)
|
||||
cleaned = Kit.clean_station_name(station_name)
|
||||
await redis_kit.set_data(f"crawled:xdt:{cleaned}", "1", expire=REDIS_STATION_EXPIRE)
|
||||
|
||||
# 检查是否已达到最大采集数量
|
||||
if total_processed_count >= max_stations_count:
|
||||
logger.info(f"已达到目标采集数量 {max_stations_count},准备结束采集。")
|
||||
break
|
||||
|
||||
# 如果内层循环已达上限,外层循环也应退出,避免不必要的滑动
|
||||
if total_processed_count >= max_stations_count:
|
||||
break
|
||||
|
||||
|
||||
# 清理已完成的后台任务
|
||||
done_tasks = [t for t in background_tasks if t.done()]
|
||||
for t in done_tasks:
|
||||
|
||||
Reference in New Issue
Block a user