From c4da6672f62eff9722ef25d06a4202c69e227a9e Mon Sep 17 00:00:00 2001 From: anhefti Date: Mon, 5 Jun 2023 12:13:41 +0200 Subject: [PATCH 1/3] test pings again --- .../servicelayer/session/impl/SEBClientPingBatchService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientPingBatchService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientPingBatchService.java index 81625a41..1b57ca64 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientPingBatchService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientPingBatchService.java @@ -52,6 +52,7 @@ public class SEBClientPingBatchService { } final int size = this.pings.size(); + System.out.println("************** size=" + size); if (size > 1000) { log.warn("----> There are more then 1000 SEB client logs in the waiting queue: {}", size); } @@ -88,6 +89,7 @@ public class SEBClientPingBatchService { final long timestamp) { if (connectionToken == null) { + System.out.println("************** connectionToken null"); return; } From d99dc58bc905a85d957c3b5f5b0722c6d8ae58eb Mon Sep 17 00:00:00 2001 From: anhefti Date: Mon, 5 Jun 2023 12:22:35 +0200 Subject: [PATCH 2/3] test logs --- .../session/impl/SEBClientEventBatchService.java | 8 ++++++++ .../session/impl/SEBClientPingBatchService.java | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientEventBatchService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientEventBatchService.java index 087808e2..688ff0a1 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientEventBatchService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientEventBatchService.java @@ -97,11 +97,17 @@ public class SEBClientEventBatchService { initialDelay = 100) public void processEvents() { + final long start = Utils.getMillisecondsNow(); + final int size = this.eventDataQueue.size(); if (size > 1000) { log.warn("-----> There are more then 1000 SEB client logs in the waiting queue: {}", size); } + if (size == 0) { + return; + } + try { this.events.clear(); @@ -131,6 +137,8 @@ public class SEBClientEventBatchService { } catch (final Exception e) { log.error("Failed to process SEB events from eventDataQueue: ", e); } + + System.out.println("************ tuck: " + (Utils.getMillisecondsNow() - start)); } private EventData convertData(final EventData eventData) { diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientPingBatchService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientPingBatchService.java index 1b57ca64..81625a41 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientPingBatchService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientPingBatchService.java @@ -52,7 +52,6 @@ public class SEBClientPingBatchService { } final int size = this.pings.size(); - System.out.println("************** size=" + size); if (size > 1000) { log.warn("----> There are more then 1000 SEB client logs in the waiting queue: {}", size); } @@ -89,7 +88,6 @@ public class SEBClientPingBatchService { final long timestamp) { if (connectionToken == null) { - System.out.println("************** connectionToken null"); return; } From c06bca1f86be159586f1d9a32dac202f96593ec0 Mon Sep 17 00:00:00 2001 From: anhefti Date: Mon, 5 Jun 2023 12:44:56 +0200 Subject: [PATCH 3/3] made default SEB client ping interval configurable --- .../sebserver/gbl/model/sebconfig/SEBClientConfig.java | 4 ++-- .../gui/content/configs/SEBClientConfigForm.java | 8 ++++++-- .../session/impl/SEBClientEventBatchService.java | 4 ---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/model/sebconfig/SEBClientConfig.java b/src/main/java/ch/ethz/seb/sebserver/gbl/model/sebconfig/SEBClientConfig.java index 0c61f1a6..3f3b26ab 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/model/sebconfig/SEBClientConfig.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/model/sebconfig/SEBClientConfig.java @@ -506,13 +506,13 @@ public final class SEBClientConfig implements GrantEntity, Activatable { this.lastUpdateUser); } - public static SEBClientConfig createNew(final Long institutionId) { + public static SEBClientConfig createNew(final Long institutionId, final long pingIterval) { return new SEBClientConfig( null, institutionId, null, ConfigPurpose.CONFIGURE_CLIENT, - 1000L, + pingIterval, VDIType.NO, null, null, diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/content/configs/SEBClientConfigForm.java b/src/main/java/ch/ethz/seb/sebserver/gui/content/configs/SEBClientConfigForm.java index be3c58b6..407e242e 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/content/configs/SEBClientConfigForm.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/content/configs/SEBClientConfigForm.java @@ -150,12 +150,14 @@ public class SEBClientConfigForm implements TemplateComposer { private final DownloadService downloadService; private final String downloadFileName; private final Cryptor cryptor; + private final long defaultSEBPingInterval; protected SEBClientConfigForm( final PageService pageService, final DownloadService downloadService, final Cryptor cryptor, - @Value("${sebserver.gui.seb.client.config.download.filename}") final String downloadFileName) { + @Value("${sebserver.gui.seb.client.config.download.filename}") final String downloadFileName, + @Value("${sebserver.gui.seb.client.config.ping.interval:1000}") final long defaultSEBPingInterval) { this.pageService = pageService; this.restService = pageService.getRestService(); @@ -163,6 +165,7 @@ public class SEBClientConfigForm implements TemplateComposer { this.currentUser = pageService.getCurrentUser(); this.downloadService = downloadService; this.downloadFileName = downloadFileName; + this.defaultSEBPingInterval = defaultSEBPingInterval; } @Override @@ -179,7 +182,8 @@ public class SEBClientConfigForm implements TemplateComposer { final SEBClientConfig clientConfig = (isNew) ? SEBClientConfig.createNew((parentEntityKey != null) ? Long.valueOf(parentEntityKey.modelId) - : user.institutionId) + : user.institutionId, + this.defaultSEBPingInterval) : this.restService .getBuilder(GetClientConfig.class) .withURIVariable(API.PARAM_MODEL_ID, entityKey.modelId) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientEventBatchService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientEventBatchService.java index 688ff0a1..0a3fe8ac 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientEventBatchService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientEventBatchService.java @@ -97,8 +97,6 @@ public class SEBClientEventBatchService { initialDelay = 100) public void processEvents() { - final long start = Utils.getMillisecondsNow(); - final int size = this.eventDataQueue.size(); if (size > 1000) { log.warn("-----> There are more then 1000 SEB client logs in the waiting queue: {}", size); @@ -137,8 +135,6 @@ public class SEBClientEventBatchService { } catch (final Exception e) { log.error("Failed to process SEB events from eventDataQueue: ", e); } - - System.out.println("************ tuck: " + (Utils.getMillisecondsNow() - start)); } private EventData convertData(final EventData eventData) {