Skip to content

Commit 3b96c17

Browse files
wbtkaralabe
authored andcommitted
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
1 parent b80c840 commit 3b96c17

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cmd/faucet/faucet.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,10 @@ func (f *faucet) apiHandler(conn *websocket.Conn) {
506506
Time: time.Now(),
507507
Tx: signed,
508508
})
509-
f.timeouts[username] = time.Now().Add(time.Duration(*minutesFlag*int(math.Pow(3, float64(msg.Tier)))) * time.Minute)
509+
timeout := time.Duration(*minutesFlag*int(math.Pow(3, float64(msg.Tier)))) * time.Minute
510+
grace := timeout / 288 // 24h timeout => 5m grace
511+
512+
f.timeouts[username] = time.Now().Add(timeout - grace)
510513
fund = true
511514
}
512515
f.lock.Unlock()

0 commit comments

Comments
 (0)