inbox service logs

This commit is contained in:
Benjamin Gamard 2018-03-03 14:39:12 +01:00
parent 65b038afcd
commit c511ed380e
2 changed files with 9 additions and 3 deletions

View File

@ -74,10 +74,12 @@ public class AppContext {
Config luceneStorageConfig = configDao.getById(ConfigType.LUCENE_DIRECTORY_STORAGE); Config luceneStorageConfig = configDao.getById(ConfigType.LUCENE_DIRECTORY_STORAGE);
indexingService = new IndexingService(luceneStorageConfig != null ? luceneStorageConfig.getValue() : null); indexingService = new IndexingService(luceneStorageConfig != null ? luceneStorageConfig.getValue() : null);
indexingService.startAsync(); indexingService.startAsync();
indexingService.awaitRunning();
// Start inbox service // Start inbox service
inboxService = new InboxService(); inboxService = new InboxService();
inboxService.startAsync(); inboxService.startAsync();
indexingService.awaitRunning();
// Register fonts // Register fonts
PdfUtil.registerFonts(); PdfUtil.registerFonts();

View File

@ -54,7 +54,11 @@ public class InboxService extends AbstractScheduledService {
@Override @Override
protected void runOneIteration() { protected void runOneIteration() {
try {
syncInbox(); syncInbox();
} catch (Exception e) {
log.error("Exception during inbox synching", e);
}
} }
/** /**
@ -77,7 +81,7 @@ public class InboxService extends AbstractScheduledService {
try { try {
inbox = openInbox(); inbox = openInbox();
Message[] messages = inbox.search(new FlagTerm(new Flags(Flags.Flag.SEEN), false)); Message[] messages = inbox.search(new FlagTerm(new Flags(Flags.Flag.SEEN), false));
log.info(messages.length + " messages found, importing..."); log.info(messages.length + " messages found");
for (Message message : messages) { for (Message message : messages) {
importMessage(message); importMessage(message);
lastSyncMessageCount++; lastSyncMessageCount++;
@ -131,7 +135,7 @@ public class InboxService extends AbstractScheduledService {
@Override @Override
protected Scheduler scheduler() { protected Scheduler scheduler() {
return Scheduler.newFixedDelaySchedule(0, 15, TimeUnit.MINUTES); return Scheduler.newFixedDelaySchedule(0, 1, TimeUnit.MINUTES);
} }
/** /**