Best practices for handling real-time user session management in Serverpod? #4608
-
|
Hi Serverpod community,
I'm currently exploring different approaches:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
You can prevent race conditions at the database level - if two requests try to create active sessions simultaneously, one will fail. and maybe you can consider |
Beta Was this translation helpful? Give feedback.
-
|
@its-kios09, Have you ever used Serverpod's database listeners or triggers to push changes instead of polling? Would that be more efficient for this use case, or does it add unnecessary complexity? |
Beta Was this translation helpful? Give feedback.
You can prevent race conditions at the database level - if two requests try to create active sessions simultaneously, one will fail.
something like this:-
and maybe you can consider
Transaction for session switches: