mirror of
https://codeberg.org/scip/kleingebaeck.git
synced 2025-12-16 12:01:00 +01:00
add throttling to image download
This commit is contained in:
6
util.go
6
util.go
@@ -20,9 +20,11 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"math/rand"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/mattn/go-isatty"
|
||||
)
|
||||
@@ -66,3 +68,7 @@ func IsNoTty() bool {
|
||||
// it is a tty
|
||||
return false
|
||||
}
|
||||
|
||||
func GetThrottleTime() time.Duration {
|
||||
return time.Duration(rand.Intn(MaxThrottle-MinThrottle+1)+MinThrottle) * time.Millisecond
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user