Browse Source

Fix notifications count update race condition in tests

pull/10612/head
ViacheslavKlimov 2 years ago
parent
commit
dd51aba417
  1. 7
      application/src/test/java/org/thingsboard/server/service/notification/NotificationApiWsClient.java

7
application/src/test/java/org/thingsboard/server/service/notification/NotificationApiWsClient.java

@ -106,8 +106,11 @@ public class NotificationApiWsClient extends TbTestWebSocketClient {
}
}
} else if (updateType == CmdUpdateType.NOTIFICATIONS_COUNT) {
lastCountUpdate = JacksonUtil.treeToValue(update, UnreadNotificationsCountUpdate.class);
unreadCount = lastCountUpdate.getTotalUnreadCount();
UnreadNotificationsCountUpdate countUpdate = JacksonUtil.treeToValue(update, UnreadNotificationsCountUpdate.class);
if (lastCountUpdate == null || countUpdate.getSequenceNumber() > lastCountUpdate.getSequenceNumber()) {
lastCountUpdate = countUpdate;
unreadCount = lastCountUpdate.getTotalUnreadCount();
}
}
super.onMessage(s);
}

Loading…
Cancel
Save