From 3b96c17fc148c8a4731a8230cd5b2d392047ef8c Mon Sep 17 00:00:00 2001 From: wbt Date: Tue, 23 Jul 2019 05:52:41 -0400 Subject: [PATCH] cmd/faucet: add grace period to faucet timeout (#18105) * Add 5 minute grace period to faucet timeout * 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 f8092084ad..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)))) * 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()