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
This commit is contained in:
wbt 2019-07-23 05:52:41 -04:00 committed by Péter Szilágyi
parent b80c840af3
commit 3b96c17fc1

View File

@ -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()