Prevent multiple sessions on a form

The time is always calculated by the server when the save function is called, so there is no need to apply a tolerance.

In the unlikely case that user A saves, then user B saves before its time ticks and shows the reload message, user B will fail to save and immediately see the reload warning.

One thing to keep in mind is that the timer should be stopped with self.timer_modified.interval = 0 before opening an alert and restarted with self.timer_modified.interval = 3 after the alert closes.

I use InputBox to manage all kind of interactions, and the alert from the timer was often interfering with the InputBox.

EDIT
Well… I realize now that I don’t need to apply a tolerance on the time because I have a dedicated server and the clock is always going to be the same for all my users, but I’m not sure this applies to apps running on shared servers.

I imagine that if the app has few users and generates very low traffic, it’s likely to always use the same instance for requests coming from a timer with a 3 second interval, but it is not guaranteed, plus I could imagine wrong.

And I don’t know how big the difference between the clock of two servers could be.

1 Like