Do the site initialization and login in parallel and wrapped in try

catch block
This commit is contained in:
0xb00bface 2021-05-06 18:49:34 +02:00
parent 698b5a5d62
commit 65ea3e1adb
1 changed files with 9 additions and 2 deletions

View File

@ -54,6 +54,7 @@ import org.slf4j.LoggerFactory;
import com.google.common.base.Objects;
import ctbrec.Config;
import ctbrec.GlobalThreadPool;
import ctbrec.NotLoggedInExcetion;
import ctbrec.Version;
import ctbrec.event.EventBusHolder;
@ -110,8 +111,14 @@ public class HttpServer {
recorder = new NextGenLocalRecorder(config, sites);
for (Site site : sites) {
if (site.isEnabled()) {
site.init();
safeLogin(site);
GlobalThreadPool.submit(() -> {
try {
site.init();
safeLogin(site);
} catch (IOException e) {
LOG.error("Error while initializing site {}", site.getName(), e);
}
});
}
}
onlineMonitor = new OnlineMonitor(recorder, config);