implemented google 2.1 (timeouts)
This commit is contained in:
parent
75c6be5861
commit
d09e496387
@ -31,9 +31,15 @@ func Google(query string) (results []Result) {
|
||||
go func(){c <- Image(query)}()
|
||||
go func(){c <- Video(query)}()
|
||||
|
||||
timeout := time.After(80 * time.Millisecond)
|
||||
for i :=0; i < 3; i++ {
|
||||
result := <-c
|
||||
select{
|
||||
case result := <- c:
|
||||
results = append(results, result)
|
||||
case <- timeout:
|
||||
fmt.Println("timed out!!")
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user