public void run() {
while(true) {
long startTime = DateTime.now().getMillis();
for(int pageNo : pageNos) {
String lastMod = pagesLastMods[pageNo];
Page page;
long pageStartTime = DateTime.now().getMillis();
try {
page = sourceBoard.getPage(pageNo, lastMod);
} catch(HttpGetException e) {
if(e.getHttpStatus() == 304)
debug(TALK, (pageNo == 0 ? "front page" : "page " + pageNo)
+ ": wasn't modified");
else
debug(WARN, "page " + pageNo + ": " + e.getMessage());
continue;
} catch(ContentGetException e) {
debug(WARN, "page " + pageNo + ": " + e.getMessage());
continue;
} catch(ContentParseException e) {
debug(WARN, "page " + pageNo + ": " + e.getMessage());
continue;
}
if(page == null) {
debug(WARN, (pageNo == 0 ? "front page" : "page " + pageNo)
+ "had no threads");
continue;
}
pagesLastMods[pageNo] = page.getLastMod();
debug(INFO, "got page " + pageNo);
for(Topic newTopic : page.getThreads()) {
int num = newTopic.getNum();
// If we never saw this topic, then we'll put it in the
// new topics queue, a TopicFetcher will take care of
// it.