jkevan commented on code in PR #488:
URL: https://github.com/apache/unomi/pull/488#discussion_r961778052


##########
rest/src/main/java/org/apache/unomi/rest/service/impl/RestServiceUtilsImpl.java:
##########
@@ -241,6 +238,11 @@ public EventsRequestContext 
performEventsRequest(List<Event> events, EventsReque
             // set Total items on context
             eventsRequestContext.setTotalItems(events.size());
 
+            boolean toStoreEventIdsInSession = false;
+            if (eventsRequestContext.getSession() != null
+                    && 
profileService.loadSession(eventsRequestContext.getSession().getItemId(), null) 
== null) {

Review Comment:
   I would be better to add an information in the EventsRequestContext object 
saying that the session is new, instead of adding here an extra call to the 
persistence to check if the session exists or not.



##########
rest/src/main/java/org/apache/unomi/rest/service/impl/RestServiceUtilsImpl.java:
##########
@@ -186,8 +185,6 @@ public EventsRequestContext initEventsRequest(String scope, 
String sessionId, St
                     // Only save session and send event if a session id was 
provided, otherwise keep transient session
 
                     Session session = new Session(sessionId, sessionProfile, 
timestamp, scope);
-                    
session.setOriginEventTypes(events.stream().map(Event::getEventType).collect(Collectors.toList()));
-                    
session.setOriginEventIds(events.stream().map(Item::getItemId).collect(Collectors.toList()));

Review Comment:
   Here: eventRequestContext.setSessionIsNew(true);



##########
rest/src/main/java/org/apache/unomi/rest/service/impl/RestServiceUtilsImpl.java:
##########
@@ -276,6 +278,10 @@ public EventsRequestContext 
performEventsRequest(List<Event> events, EventsReque
                     if ((eventsRequestContext.getChanges() & 
EventService.PROFILE_UPDATED) == EventService.PROFILE_UPDATED) {
                         
eventsRequestContext.setProfile(eventToSend.getProfile());
                     }
+                    if(toStoreEventIdsInSession){

Review Comment:
   Here: if (eventsRequestContext.isSessionNew()) {...}



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to