educative.io

Educative

Adding a buffer of five seconds on the server to safeguard from a broken experience

On the server, ActiveReservationsService keeps track of expiry (based on reservation time) of active reservations. As the client will be shown a timer (for the expiration time), which could be a little out of sync with the server, we can add a buffer of five seconds on the server to safeguard from a broken experience, such that the client never times out after the server, preventing a successful purchase.

does this mean that the server will tell the client that the expiration has expired earlier that it really should? this is to make sure that the client doesn’t get a booking failure when it thinks that it still has time. how does the client get out of sync with the server?

Hi @Dewey_Munoz, We are glad you reached us.

The text here means that there will be 5 seconds of buffer just to keep the Client on the safe side so that the reservation does not abruptly expire in between the time user decides for the purchase. The ActiveReservationsService and the Client are not directly communicating, ActiveReservationsService communicated with the Application Server which communicates with the Web Server and Web Server communicates with the Client so this may happen that ActiveReservationsService has decided the expiration and till the message moves to the Client, the Client is already in the middle of the purchase request.

This is what we do not want, so in order to save the user from getting out of sync with the server an additional buffer of 5 seconds is added to the server.

We hope Educative has helped you in your learning experience:)