From f60cbb7f0d088b400fad131d565af5b0fc31afb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Tue, 23 Jul 2019 12:35:44 +0300 Subject: [PATCH] cmd/faucet: make grace period dynamic based on original wait time --- cmd/faucet/faucet.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/faucet/faucet.go b/cmd/faucet/faucet.go index a01e6381b7..905eeb24a7 100644 --- a/cmd/faucet/faucet.go +++ b/cmd/faucet/faucet.go @@ -506,7 +506,10 @@ func (f *faucet) apiHandler(conn *websocket.Conn) { Time: time.Now(), Tx: signed, }) - f.timeouts[username] = time.Now().Add(time.Duration(*minutesFlag*int(math.Pow(3, float64(msg.Tier)))-5) * time.Minute) + timeout := time.Duration(*minutesFlag*int(math.Pow(3, float64(msg.Tier)))) * time.Minute + grace := timeout / 288 // 24h timeout => 5m grace + + f.timeouts[username] = time.Now().Add(timeout - grace) fund = true } f.lock.Unlock()