anweiguo 2 月之前
父節點
當前提交
381109329a
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      data_processing/data_operation/data_nwp_ftp.py

+ 5 - 4
data_processing/data_operation/data_nwp_ftp.py

@@ -241,10 +241,11 @@ def get_nwp_from_ftp():
         date, moment = get_moment_next(args.get('dt'))
         logger.info("从日期{}时刻{}开始查找文件".format(date, moment))
         success = select_file_to_mongo(args, date, moment)
-        while not success:
-            date, moment = get_previous_moment(date, moment)
-            logger.info("未找到,从日期{}时刻{}开始查找文件".format(date, moment))
-            success = select_file_to_mongo(args, date, moment)
+        new_date = date
+        while not success and date == new_date:
+            new_date, moment = get_previous_moment(date, moment)
+            logger.info("未找到,从日期{}时刻{}开始查找文件".format(new_date, moment))
+            success = select_file_to_mongo(args, new_date, moment)
     except Exception as e:
         my_exception = traceback.format_exc()
         my_exception.replace("\n", "\t")