From b372934a905557ebcb40098940bae5655c5d20b8 Mon Sep 17 00:00:00 2001 From: Patrick Peng Sun Date: Sun, 9 Jul 2017 03:50:08 +1000 Subject: [PATCH] skip DB query if lead record is less than 1 day old. --- server.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server.go b/server.go index 3e6910b..f453d88 100644 --- a/server.go +++ b/server.go @@ -215,6 +215,13 @@ func timestampTooOld(ts int32) bool { return diff > 180 //3 minutes, 180 seconds } +func timestampOldThan(ts int32, sec int32) bool { + //diff > 3min from now + now := int32(time.Now().Unix()) + diff := now - ts + return diff > sec +} + // func checkSignature1() bool { // s1 := "e39de9f2e28079c01ebb4b803dfc3442b819545c" // t1 := "1492970761"