diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientEventDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientEventDAOImpl.java index d58b9e64..fe3a5469 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientEventDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ClientEventDAOImpl.java @@ -294,7 +294,7 @@ public class ClientEventDAOImpl implements ClientEventDAO { isEqualToWhenPresent(examId)) .and( ClientConnectionRecordDynamicSqlSupport.status, - isEqualTo(ConnectionStatus.ACTIVE.name())) + isIn(ConnectionStatus.ACTIVE.name(), ConnectionStatus.CONNECTION_REQUESTED.name())) .and( ClientNotificationRecordDynamicSqlSupport.eventType, isEqualTo(EventType.NOTIFICATION.id)) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/SEBClientNotificationService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/SEBClientNotificationService.java index 82e29b68..8e55e520 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/SEBClientNotificationService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/SEBClientNotificationService.java @@ -35,6 +35,9 @@ public interface SEBClientNotificationService { * @return Result refer to pending client notifications or to an error when happened */ Result> getPendingNotifications(Long clientConnectionId); + /** This creates/register a new pending notification. + * + * @param notification The ClientNotification data */ void newNotification(ClientNotification notification); /** This is used to confirm a pending notification from SEB client side where diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientNotificationServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientNotificationServiceImpl.java index 21f43e49..89a1c31f 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientNotificationServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/SEBClientNotificationServiceImpl.java @@ -66,15 +66,12 @@ public class SEBClientNotificationServiceImpl implements SEBClientNotificationSe this.clientConnectionDAO = clientConnectionDAO; this.sebClientInstructionService = sebClientInstructionService; if (webserviceInfo.isDistributed()) { - this.updateInterval = Constants.SECOND_IN_MILLIS; + this.updateInterval = 2 * Constants.SECOND_IN_MILLIS; } } @Override public Boolean hasAnyPendingNotification(final ClientConnection clientConnection) { - if (!clientConnection.status.clientActiveStatus) { - return false; - } updateCache(clientConnection.examId); return this.pendingNotifications.contains(clientConnection.id); } @@ -138,7 +135,7 @@ public class SEBClientNotificationServiceImpl implements SEBClientNotificationSe private ClientNotification notifyNewNotifiaction(final ClientNotification notification) { if (notification.eventType == EventType.NOTIFICATION) { - this.pendingNotifications.add(notification.id); + this.pendingNotifications.add(notification.getConnectionId()); } return notification; }