import org.sonar.server.search.action.KeyIndexAction;
import javax.annotation.CheckForNull;
-
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
RuleKey.of(map.get("repoField"), map.get("ruleField"))));
}
});
+ session.commit();
}
/**
SearchResponse response = request.get();
Max max = (Max) response.getAggregations().get("latest");
- if (Double.isNaN(max.getValue())) {
- date = new Date(0L);
- } else {
+
+ if (max.getValue() > 0) {
date = new DateTime(Double.valueOf(max.getValue()).longValue()).toDate();
+ } else {
+ date = new Date(0L);
}
LOG.info("Index {}:{} has last update of {}", this.getIndexName(), this.getIndexType(), date);
synchronize(session, db.activeRuleDao(), index.get(ActiveRuleIndex.class));
synchronize(session, db.activityDao(), index.get(ActivityIndex.class));
session.commit();
- LOG.info("Synchronization done in {}ms...", System.currentTimeMillis()-start);
+ LOG.info("Synchronization done in {}ms...", System.currentTimeMillis() - start);
session.close();
}
long start = System.currentTimeMillis();
dao.synchronizeAfter(session,
index.getLastSynchronization());
- LOG.info("-- Synchronized {} in {}ms", index.getIndexType(), System.currentTimeMillis() - start);
}
}