Automatic conversion at start-up given correct conditions

This commit is contained in:
Viktor Lofgren 2023-03-04 16:00:17 +01:00
parent 3b5002aac8
commit 6130908285
2 changed files with 9 additions and 5 deletions

View File

@ -86,12 +86,18 @@ public class IndexService extends Service {
}
private void autoConvert() {
if (!servicesFactory.isConvertedIndexMissing() || !servicesFactory.isPreconvertedIndexPresent()) {
if (!servicesFactory.isConvertedIndexMissing()
|| !servicesFactory.isPreconvertedIndexPresent()
|| Boolean.getBoolean("no-auto-convert")
) {
return;
}
try {
logger.info("Auto-converting");
searchSetsService.recalculateAll();
searchIndex.switchIndex();
logger.info("Auto-conversion finished!");
}
catch (IOException ex) {
logger.error("Auto convert failed", ex);

View File

@ -42,9 +42,8 @@ public class IndexServicesFactory {
private final Path searchSetsBase;
int LIVE_PART = 0;
int NEXT_PART = 1;
final int LIVE_PART = 0;
final int NEXT_PART = 1;
@Inject
public IndexServicesFactory(
@ -100,7 +99,6 @@ public class IndexServicesFactory {
}
private void convertFullReverseIndex(DomainRankings domainRankings) throws IOException {
var source = writerIndexFile.get(0).toPath();
logger.info("Converting full reverse index {}", source);