tracardi
tracardi copied to clipboard
Until the session is saved system can create many profiles for 1 session
Describe the bug Until the session is saved and it is usually within 1s the system can create many profiles for 1 session. System checks if the session exists by loading it from ES. If it is a new session then is does not exist and must be saved before it can be read. So there is a 1s when system thinks that the session does not exist.
To Reproduce Steps to reproduce the behavior: In the test console type "1" as session id. It must be a new session that does not exist in the system. Select source and quickly click Submit button. Within 1s you will create many profiles. After 1s the system has a copy of session in ES and you will not be able to create new profiles. You can verify it with the response it will return different profile ids.
Expected behavior Single profile for single session
Additional context There are two solutions for this issue. One is to:
- [ ] save session in redis (with TTL like 10s) and check cache before we read session.
- [ ] if the session is new save it and refresh right after it is created. I guess both solutions could be implemented.