Commit cc442545 by chenweitao

Merge branch 'mlbWork' into 'master'

redis连接执行完关闭

See merge request !54
parents d73bb8fa 1caeb3fb
......@@ -168,6 +168,7 @@ public class WeiboHotSearchCrawler {
continue;
}
// }
redisDao.closeRedis();
return result;
} catch (Exception e) {
log.error("解析微博时热搜时出现解析错误,数据不是json结构", e);
......@@ -176,6 +177,7 @@ public class WeiboHotSearchCrawler {
log.info("解析微博时热搜时出现解析错误,页面结构有问题");
}
}
redisDao.closeRedis();
return Collections.emptyList();
}
......
......@@ -69,4 +69,11 @@ public class RedisDao {
public void removeRedis(String key){
jedis.del(key);
}
/**
* 关闭redis连接
*/
public void closeRedis(){
jedis.close();
}
}
......@@ -45,7 +45,7 @@ public class GatherTimer {
logger.info("微博热搜开始采集...");
Date date = DateUtils.getMillSecondTime(new Date());
List<HotSearchList> weiboList = WeiboHotSearchCrawler.weiboHotSearchByPhone(date);
logger.info("{}, 微博此轮采集到的数据量为:{}", new Date(), Integer.valueOf(weiboList != null ? weiboList.size() : 0));
logger.info("{}, 微博此轮采集到的数据量为:{}", new Date(), weiboList != null ? weiboList.size() : 0);
TipsUtils.addHotList(HotSearchType.微博热搜.name(),weiboList);
logger.info("微博热搜采集结束...");
}
......@@ -73,6 +73,7 @@ public class GatherTimer {
ZhiWeiTools.sleep(3000L);
}
}
redisDao.closeRedis();
logger.info("微博热搜导语更新结束...");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment