1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

chore: allow heartbeats from one hour into the future to compensate for clock inaccuracies (see #342)

This commit is contained in:
Ferdinand Mütsch 2022-03-19 09:02:15 +01:00
parent 4cea50b5c8
commit eae45baf38

View File

@ -36,7 +36,7 @@ func (h *Heartbeat) Valid() bool {
func (h *Heartbeat) Timely(maxAge time.Duration) bool { func (h *Heartbeat) Timely(maxAge time.Duration) bool {
now := time.Now() now := time.Now()
return now.Sub(h.Time.T()) <= maxAge && h.Time.T().Before(now) return now.Sub(h.Time.T()) <= maxAge && h.Time.T().Sub(now) < 1*time.Hour
} }
func (h *Heartbeat) Augment(languageMappings map[string]string) { func (h *Heartbeat) Augment(languageMappings map[string]string) {