lundi 5 novembre 2018

How to handle time out of sync between servers

I'm curious if anyone has a best practice or suggestion for my situation:

  • a server on which I do not have any influence over offers data via REST.
  • The data is only valid for a specific timeframe and gets regularly refreshed.
  • The time when the next refresh happens is known via a http headerfield. In the header there is also the current time of the server.
  • the time on the server is off a few seconds (seems that is is not sync'ed via NTP)

my task is the following:

  • grab the new data as short as possible after its refreshed by the server

my question is:

  • should I just save the offset-seconds between my servers time and the target server per request and adjust my next pull accordingly?
  • should I create some kind of "otherserver"-clock which is regularly synchronized to the clock of the other server and has its offset to trigger my next pull?

What my question is not about: handling of time/timezone.

Best solution would enable me to grab the data right after its update from the other server.

Best Wishes, Florian

Aucun commentaire:

Enregistrer un commentaire