mirror of
https://github.com/201206030/novel.git
synced 2025-04-27 07:30:50 +00:00
更新优化
This commit is contained in:
parent
bb83f5628b
commit
04ab2045f3
@ -125,7 +125,6 @@ public class BiquCrawlSource extends BaseHtmlCrawlSource {
|
||||
@Override
|
||||
public void update() {
|
||||
List<BookParseLog> logs = bookService.queryBookParseLogs();
|
||||
List<Long> successLogIds = new ArrayList<>();
|
||||
for (BookParseLog bookParseLog : logs) {
|
||||
try {
|
||||
|
||||
@ -241,7 +240,7 @@ public class BiquCrawlSource extends BaseHtmlCrawlSource {
|
||||
|
||||
}
|
||||
}
|
||||
successLogIds.add(bookParseLog.getId());
|
||||
bookService.deleteBookParseLog(bookParseLog.getId());
|
||||
}
|
||||
|
||||
|
||||
@ -266,7 +265,7 @@ public class BiquCrawlSource extends BaseHtmlCrawlSource {
|
||||
}
|
||||
}
|
||||
|
||||
bookService.deleteBookParseLogs(successLogIds);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,6 @@ public class StartListener implements ServletContextListener {
|
||||
|
||||
log.info("updateBooks执行中。。。。。。。。。。。。");
|
||||
crawlSource.update();
|
||||
Thread.sleep(new Float(1000 * 60 * bookUpdatePeriod).longValue());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
@ -510,4 +510,12 @@ public class BookService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除已经成功更新的解析日志
|
||||
* */
|
||||
public void deleteBookParseLog(Long id) {
|
||||
bookParseLogMapper.deleteByPrimaryKey(id);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user