Removed time.Sleep statements in jobs

This commit is contained in:
Eduard Urbach 2018-07-03 12:27:34 +09:00
parent bd6291290b
commit 21823890e0
10 changed files with 49 additions and 22 deletions

View File

@ -4,7 +4,6 @@ import (
"fmt"
"net/http"
"sort"
"time"
_ "image/gif"
_ "image/jpeg"
@ -33,8 +32,6 @@ func main() {
fmt.Printf("[%d / %d] %s %s\n", index+1, len(characters), character.ID, color.CyanString(character.String()))
download(character.ID)
}
time.Sleep(time.Second)
}
func download(characterID string) {

View File

@ -2,7 +2,6 @@ package main
import (
"fmt"
"time"
"github.com/animenotifier/arn"
"github.com/fatih/color"
@ -32,8 +31,5 @@ func main() {
// Save the file information
track.Save()
// Delay a little
time.Sleep(delayBetweenRequests)
}
}

View File

@ -40,6 +40,4 @@ func main() {
character.Save()
}
time.Sleep(1 * time.Second)
}

View File

@ -2,7 +2,6 @@ package main
import (
"fmt"
"time"
"github.com/animenotifier/arn"
"github.com/fatih/color"
@ -55,5 +54,4 @@ func main() {
}
fmt.Println(len(used), len(characters))
time.Sleep(2 * time.Second)
}

View File

@ -2,7 +2,6 @@ package main
import (
"fmt"
"time"
"github.com/animenotifier/arn"
"github.com/fatih/color"
@ -40,6 +39,4 @@ func main() {
animeList.Save()
}
}
time.Sleep(time.Second)
}

View File

@ -21,6 +21,5 @@ func main() {
// newID := arn.GenerateID("Anime")
// fmt.Printf("[%d / %d] Old [%s] New [%s] %s\n", counter+1, len(allAnime), color.YellowString(anime.ID), color.GreenString(newID), anime)
// anime.SetID(newID)
// time.Sleep(100 * time.Millisecond)
// }
}

View File

@ -27,6 +27,4 @@ func main() {
anime.Save()
}
}
time.Sleep(1 * time.Second)
}

View File

@ -3,7 +3,6 @@ package main
import (
"fmt"
"sort"
"time"
"github.com/animenotifier/arn"
"github.com/fatih/color"
@ -41,6 +40,4 @@ func main() {
}
}
}
time.Sleep(1 * time.Second)
}

View File

@ -6,7 +6,6 @@ import (
"image"
"os"
"path"
"time"
"github.com/animenotifier/arn"
"github.com/fatih/color"
@ -20,7 +19,6 @@ import (
func main() {
defer color.Green("Finished.")
defer arn.Node.Close()
defer time.Sleep(time.Second)
characters := arn.FilterCharacters(func(character *arn.Character) bool {
return character.HasImage()

View File

@ -0,0 +1,49 @@
package main
import (
"flag"
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
// Shell parameters
var nick string
var service string
var serviceID string
// Shell flags
func init() {
flag.StringVar(&nick, "nick", "", "Nick of the user")
flag.StringVar(&service, "service", "", "Service name (Google or Facebook)")
flag.StringVar(&serviceID, "serviceID", "", "ID of the user on the given service")
flag.Parse()
}
func main() {
if nick == "" || service == "" || serviceID == "" {
flag.Usage()
return
}
color.Yellow("Updating user service ID")
defer color.Green("Finished.")
defer arn.Node.Close()
user, err := arn.GetUserByNick(nick)
arn.PanicOnError(err)
switch service {
case "Google":
user.ConnectGoogle(serviceID)
case "Facebook":
user.ConnectFacebook(serviceID)
default:
panic("Unknown service")
}
user.Save()
}