Request delays support added

This commit is contained in:
Musab Gültekin
2019-06-09 14:24:53 +03:00
parent 2263108838
commit b973c1c064
4 changed files with 32 additions and 2 deletions

View File

@ -5,7 +5,9 @@ import (
"github.com/PuerkitoBio/goquery"
"github.com/fpfeng/httpcache"
"github.com/geziyor/geziyor"
"math/rand"
"testing"
"time"
)
func TestGeziyor_Simple(t *testing.T) {
@ -69,3 +71,12 @@ func TestGeziyor_Concurrent_Requests(t *testing.T) {
})
gez.Start()
}
func TestRandomDelay(t *testing.T) {
rand.Seed(time.Now().UnixNano())
delay := time.Millisecond * 1000
min := float64(delay) * 0.5
max := float64(delay) * 1.5
randomDelay := rand.Intn(int(max-min)) + int(min)
fmt.Println(time.Duration(randomDelay))
}