Fix timeout issues

This commit is contained in:
Eduard Urbach 2017-07-13 09:20:12 +02:00
parent d6155bf3a1
commit 86b2eea13a
2 changed files with 5 additions and 2 deletions

View File

@ -11,9 +11,10 @@ import (
func main() { func main() {
color.Yellow("Refreshing anime characters...") color.Yellow("Refreshing anime characters...")
allAnime, _ := arn.AllAnime()
rateLimiter := time.NewTicker(500 * time.Millisecond) rateLimiter := time.NewTicker(500 * time.Millisecond)
for anime := range arn.MustStreamAnime() { for _, anime := range allAnime {
<-rateLimiter.C <-rateLimiter.C
chars, err := anime.RefreshAnimeCharacters() chars, err := anime.RefreshAnimeCharacters()

View File

@ -96,8 +96,10 @@ func main() {
usersQueue := make(chan *arn.User, runtime.NumCPU()) usersQueue := make(chan *arn.User, runtime.NumCPU())
StartWorkers(usersQueue, Work) StartWorkers(usersQueue, Work)
allUsers, _ := arn.AllUsers()
// We'll send each user to one of the worker threads // We'll send each user to one of the worker threads
for user := range arn.MustStreamUsers() { for _, user := range allUsers {
wg.Add(1) wg.Add(1)
usersQueue <- user usersQueue <- user
} }