浏览代码

限制获取天气频率

peng 1 年之前
父节点
当前提交
a1c1750ad6
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Controller/WeatherControl.py

+ 1 - 1
Controller/WeatherControl.py

@@ -58,7 +58,7 @@ class WeatherView(View):
                 city_obj = WeatherInfo(city_id)
                 temp, humidity = city_obj.get_city_weather()
                 if temp and humidity:
-                    redis_obj.set_ex_data('city_id_{}_weather'.format(city_id), '{}/{}'.format(temp, humidity), 600)
+                    redis_obj.set_ex_data('city_id_{}_weather'.format(city_id), '{}/{}'.format(temp, humidity), 1800)
             if not all([temp, humidity]):
                 return response.json(10, '获取天气失败')
             return response.json(0, {'temp': temp, 'humidity': humidity})