diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/ProctorRoomConnectionsPopup.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/ProctorRoomConnectionsPopup.java index 87a367eb..46139f15 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/ProctorRoomConnectionsPopup.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/ProctorRoomConnectionsPopup.java @@ -75,23 +75,25 @@ public class ProctorRoomConnectionsPopup { .call() .getOrThrow()); - this.pageService.staticListTableBuilder(connections, EntityType.CLIENT_CONNECTION) + final EntityTable compose = + this.pageService.staticListTableBuilder(connections, EntityType.CLIENT_CONNECTION) - .withEmptyMessage(EMPTY_LIST_TEXT_KEY) - .withPaging(10) + .withEmptyMessage(EMPTY_LIST_TEXT_KEY) + .withPaging(10) - .withColumn(new ColumnDefinition<>( - Domain.CLIENT_CONNECTION.ATTR_EXAM_USER_SESSION_ID, - TABLE_COLUMN_NAME, - ClientConnection::getUserSessionId)) + .withColumn(new ColumnDefinition<>( + Domain.CLIENT_CONNECTION.ATTR_EXAM_USER_SESSION_ID, + TABLE_COLUMN_NAME, + ClientConnection::getUserSessionId)) - .withDefaultAction(t -> actionBuilder - .newAction(ActionDefinition.MONITOR_EXAM_CLIENT_CONNECTION) - .withParentEntityKey(parentEntityKey) - .withExec(action -> showClientConnection(action, dialog, t)) - .create()) + .withDefaultAction(t -> actionBuilder + .newAction(ActionDefinition.MONITOR_EXAM_CLIENT_CONNECTION) + .withParentEntityKey(parentEntityKey) + .withExec(action -> showClientConnection(action, dialog, t)) + .create()) - .compose(pageContext); + .compose(pageContext); + compose.reset(); } private PageAction showClientConnection( diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/table/StaticListPageSupplier.java b/src/main/java/ch/ethz/seb/sebserver/gui/table/StaticListPageSupplier.java index 145426a9..b7ace63f 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/table/StaticListPageSupplier.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/table/StaticListPageSupplier.java @@ -106,8 +106,17 @@ public class StaticListPageSupplier implements PageSupplier { if (numOfPages <= 0) { return new Page<>(1, 1, this.column, this.list); } - final List subList = this.list.subList(this.pageNumber * this.pageSize, - this.pageNumber * this.pageSize + this.pageSize); + + int from = (this.pageNumber - 1) * this.pageSize; + if (from < 0) { + from = 0; + } + int to = (this.pageNumber - 1) * this.pageSize + this.pageSize; + if (to >= this.list.size()) { + to = this.list.size(); + } + + final List subList = this.list.subList(from, to); return new Page<>(numOfPages, this.pageNumber, this.column, subList); }); } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/DistributedPingCache.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/DistributedPingCache.java index 979df7fa..5c027577 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/DistributedPingCache.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/DistributedPingCache.java @@ -21,6 +21,7 @@ import org.joda.time.DateTimeUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.DisposableBean; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Lazy; import org.springframework.scheduling.TaskScheduler; import org.springframework.stereotype.Component; @@ -52,13 +53,14 @@ public class DistributedPingCache implements DisposableBean { final ClientEventLastPingMapper clientEventLastPingMapper, final ClientEventRecordMapper clientEventRecordMapper, final WebserviceInfo webserviceInfo, - final TaskScheduler taskScheduler) { + final TaskScheduler taskScheduler, + @Value("${sebserver.webservice.distributed.pingUpdate:3000}") final long pingUpdate) { this.clientEventLastPingMapper = clientEventLastPingMapper; this.clientEventRecordMapper = clientEventRecordMapper; if (webserviceInfo.isDistributed()) { try { - this.taskRef = taskScheduler.scheduleAtFixedRate(this::updateCache, 1000); + this.taskRef = taskScheduler.scheduleAtFixedRate(this::updateCache, pingUpdate); } catch (final Exception e) { log.error("Failed to initialize distributed ping cache update task"); this.taskRef = null; @@ -127,7 +129,6 @@ public class DistributedPingCache implements DisposableBean { } } - @Transactional public void updatePing(final Long pingRecordId, final Long pingTime) { try { @@ -156,6 +157,8 @@ public class DistributedPingCache implements DisposableBean { } catch (final Exception e) { log.error("Failed to delete ping for connection -> {}", connectionId, e); + } finally { + this.pingCache.remove(connectionId); } } diff --git a/src/main/resources/config/application-dev-ws.properties b/src/main/resources/config/application-dev-ws.properties index 277c15de..1c7aa00b 100644 --- a/src/main/resources/config/application-dev-ws.properties +++ b/src/main/resources/config/application-dev-ws.properties @@ -13,6 +13,7 @@ spring.datasource.hikari.initializationFailTimeout=30000 spring.datasource.hikari.connectionTimeout=30000 spring.datasource.hikari.idleTimeout=600000 spring.datasource.hikari.maxLifetime=1800000 +spring.datasource.hikari.maximumPoolSize=500 sebserver.http.client.connect-timeout=15000 sebserver.http.client.connection-request-timeout=10000 diff --git a/src/main/resources/config/application-gui.properties b/src/main/resources/config/application-gui.properties index f7a8edfa..1b89c317 100644 --- a/src/main/resources/config/application-gui.properties +++ b/src/main/resources/config/application-gui.properties @@ -25,7 +25,7 @@ sebserver.gui.entrypoint=/gui sebserver.gui.webservice.apipath=${sebserver.webservice.api.admin.endpoint} # defines the polling interval that is used to poll the webservice for client connection data on a monitored exam page -sebserver.gui.webservice.poll-interval=1000 +sebserver.gui.webservice.poll-interval=3000 sebserver.gui.webservice.mock-lms-enabled=true sebserver.gui.webservice.edx-lms-enabled=true sebserver.gui.webservice.moodle-lms-enabled=true diff --git a/src/main/resources/config/application-ws.properties b/src/main/resources/config/application-ws.properties index 9e6c6799..a8b7c3e0 100644 --- a/src/main/resources/config/application-ws.properties +++ b/src/main/resources/config/application-ws.properties @@ -10,6 +10,9 @@ sebserver.init.adminaccount.username=sebserver-admin sebserver.init.database.integrity.checks=true sebserver.init.database.integrity.try-fix=true +sebserver.webservice.distributed=false +sebserver.webservice.distributed.pingUpdate=3000 + ### webservice caching spring.cache.jcache.provider=org.ehcache.jsr107.EhcacheCachingProvider spring.cache.jcache.config=classpath:config/ehcache.xml @@ -28,6 +31,7 @@ spring.datasource.hikari.initializationFailTimeout=3000 spring.datasource.hikari.connectionTimeout=30000 spring.datasource.hikari.idleTimeout=600000 spring.datasource.hikari.maxLifetime=1800000 +spring.datasource.hikari.maximumPoolSize=500 ### webservice security spring.datasource.password=${sebserver.mariadb.password}