sync session caches when needed, code cleanup

This commit is contained in:
anhefti 2020-01-20 09:48:02 +01:00
parent 3b8924ac53
commit 351148e435
4 changed files with 17 additions and 10 deletions

View file

@ -82,7 +82,7 @@ public class MonitoringRunningExam implements TemplateComposer {
final PageService pageService,
final ResourceService resourceService,
final InstructionProcessor instructionProcessor,
@Value("${sebserver.gui.webservice.poll-interval:500}") final long pollInterval) {
@Value("${sebserver.gui.webservice.poll-interval:1000}") final long pollInterval) {
this.serverPushService = serverPushService;
this.pageService = pageService;

View file

@ -64,10 +64,10 @@ public final class ClientConnectionTable {
private static final Logger log = LoggerFactory.getLogger(ClientConnectionTable.class);
private static final int BOTTOM_PADDING = 20;
private static final int NUMBER_OF_NONE_INDICATOR_COLUMNS = 3;
private static final String INDICATOR_NAME_TEXT_KEY_PREFIX =
"sebserver.monitoring.connection.list.column.indicator.";
private final static LocTextKey CONNECTION_ID_TEXT_KEY =
new LocTextKey("sebserver.monitoring.connection.list.column.id");
private final static LocTextKey CONNECTION_ADDRESS_TEXT_KEY =
@ -75,8 +75,6 @@ public final class ClientConnectionTable {
private final static LocTextKey CONNECTION_STATUS_TEXT_KEY =
new LocTextKey("sebserver.monitoring.connection.list.column.status");
private static final int NUMBER_OF_NONE_INDICATOR_COLUMNS = 3;
private final WidgetFactory widgetFactory;
private final ResourceService resourceService;
private final Exam exam;

View file

@ -579,14 +579,14 @@ public class TableFilter<ROW extends Entity> {
@Override
String getValue() {
if (this.fromDateSelector != null && this.toDateSelector != null) {
final org.joda.time.DateTime fromDate = org.joda.time.DateTime.now(DateTimeZone.UTC)
org.joda.time.DateTime fromDate = org.joda.time.DateTime.now(DateTimeZone.UTC)
.withYear(this.fromDateSelector.getYear())
.withMonthOfYear(this.fromDateSelector.getMonth() + 1)
.withDayOfMonth(this.fromDateSelector.getDay())
.withHourOfDay((this.fromTimeSelector != null) ? this.fromTimeSelector.getHours() : 0)
.withMinuteOfHour((this.fromTimeSelector != null) ? this.fromTimeSelector.getMinutes() : 0)
.withSecondOfMinute((this.fromTimeSelector != null) ? this.fromTimeSelector.getSeconds() : 0);
final org.joda.time.DateTime toDate = org.joda.time.DateTime.now(DateTimeZone.UTC)
org.joda.time.DateTime toDate = org.joda.time.DateTime.now(DateTimeZone.UTC)
.withYear(this.toDateSelector.getYear())
.withMonthOfYear(this.toDateSelector.getMonth() + 1)
.withDayOfMonth(this.toDateSelector.getDay())
@ -594,6 +594,13 @@ public class TableFilter<ROW extends Entity> {
.withMinuteOfHour((this.toTimeSelector != null) ? this.toTimeSelector.getMinutes() : 0)
.withSecondOfMinute((this.toTimeSelector != null) ? this.toTimeSelector.getSeconds() : 0);
if (this.fromTimeSelector == null) {
fromDate = fromDate.withTimeAtStartOfDay();
}
if (this.toTimeSelector == null) {
toDate = toDate.plusDays(1).withTimeAtStartOfDay();
}
return fromDate.toString(Constants.STANDARD_DATE_TIME_FORMATTER) +
Constants.EMBEDDED_LIST_SEPARATOR +
toDate.toString(Constants.STANDARD_DATE_TIME_FORMATTER);
@ -635,7 +642,6 @@ public class TableFilter<ROW extends Entity> {
log.error("Failed to set date range filter attribute: ", e);
}
}
}
}

View file

@ -77,7 +77,8 @@ public class ExamSessionCacheService {
@Cacheable(
cacheNames = CACHE_NAME_RUNNING_EXAM,
key = "#examId",
unless = "#result == null")
unless = "#result == null",
sync = true)
public Exam getRunningExam(final Long examId) {
if (log.isDebugEnabled()) {
@ -165,7 +166,8 @@ public class ExamSessionCacheService {
@Cacheable(
cacheNames = CACHE_NAME_SEB_CONFIG_EXAM,
key = "#exam.id",
unless = "#result == null")
unless = "#result == null",
sync = true)
public InMemorySebConfig getDefaultSebConfigForExam(final Exam exam) {
try {
@ -195,7 +197,8 @@ public class ExamSessionCacheService {
@Cacheable(
cacheNames = CACHE_NAME_PING_RECORD,
key = "#connectionToken",
unless = "#result == null")
unless = "#result == null",
sync = true)
@Transactional
public ClientEventRecord getPingRecord(final String connectionToken) {
if (log.isDebugEnabled()) {