diff --git a/jobs/anime-characters/anime-characters.go b/jobs/anime-characters/anime-characters.go index e585175c..7a530b14 100644 --- a/jobs/anime-characters/anime-characters.go +++ b/jobs/anime-characters/anime-characters.go @@ -10,6 +10,8 @@ import ( func main() { color.Yellow("Refreshing anime characters...") + + defer color.Green("Finished.") defer arn.Node.Close() rateLimiter := time.NewTicker(500 * time.Millisecond) @@ -26,6 +28,4 @@ func main() { fmt.Printf("%s %s (%d characters)\n", anime.ID, anime.Title.Canonical, len(chars.Items)) } - - color.Green("Finished.") } diff --git a/jobs/anime-images/anime-images.go b/jobs/anime-images/anime-images.go index b180e485..144b7588 100644 --- a/jobs/anime-images/anime-images.go +++ b/jobs/anime-images/anime-images.go @@ -37,6 +37,8 @@ func init() { func main() { color.Yellow("Downloading anime images") + + defer color.Green("Finished.") defer arn.Node.Close() if from < 0 { @@ -53,8 +55,6 @@ func main() { work(anime) } - color.Green("Finished downloading anime images.") - // Give file buffers some time, just to be safe time.Sleep(time.Second) } diff --git a/jobs/anime-ratings/anime-ratings.go b/jobs/anime-ratings/anime-ratings.go index 37627b47..0e905106 100644 --- a/jobs/anime-ratings/anime-ratings.go +++ b/jobs/anime-ratings/anime-ratings.go @@ -13,6 +13,8 @@ var popularity = map[string]*arn.AnimePopularity{} // made to it. func main() { color.Yellow("Updating anime ratings") + + defer color.Green("Finished.") defer arn.Node.Close() allAnimeLists, err := arn.AllAnimeLists() @@ -93,8 +95,6 @@ func main() { anime.Popularity = popularity[animeID] anime.Save() } - - color.Green("Finished.") } func average(floatSlice []float64) float64 { diff --git a/jobs/mal-download/mal-download.go b/jobs/mal-download/mal-download.go index a8c89cd7..0f7ef704 100644 --- a/jobs/mal-download/mal-download.go +++ b/jobs/mal-download/mal-download.go @@ -72,6 +72,12 @@ func main() { count++ } + // Log number of links color.Yellow("Queued up %d links", count) + + // Wait for completion malCrawler.Wait() + + // Finished + color.Green("Finished.") } diff --git a/jobs/refresh-episodes/refresh-episodes.go b/jobs/refresh-episodes/refresh-episodes.go index e022e4bd..30bbf276 100644 --- a/jobs/refresh-episodes/refresh-episodes.go +++ b/jobs/refresh-episodes/refresh-episodes.go @@ -10,6 +10,8 @@ import ( func main() { color.Yellow("Refreshing episode information for each anime.") + + defer color.Green("Finished.") defer arn.Node.Close() if InvokeShellArgs() { @@ -59,8 +61,6 @@ func main() { color.Cyan("Low priority queue (%d):", len(lowPriority)) refreshQueue(lowPriority) } - - color.Green("Finished.") } func refreshQueue(queue []*arn.Anime) { diff --git a/jobs/soundtrack-download/soundtrack-download.go b/jobs/soundtrack-download/soundtrack-download.go index d896cc77..1608b27d 100644 --- a/jobs/soundtrack-download/soundtrack-download.go +++ b/jobs/soundtrack-download/soundtrack-download.go @@ -12,6 +12,8 @@ const delayBetweenRequests = 1000 func main() { color.Yellow("Downloading soundtracks") + + defer color.Green("Finished.") defer arn.Node.Close() for track := range arn.StreamSoundTracks() { @@ -34,6 +36,4 @@ func main() { // Delay a little time.Sleep(delayBetweenRequests) } - - color.Green("Finished.") } diff --git a/jobs/sync-characters/sync-characters.go b/jobs/sync-characters/sync-characters.go index 244e5bdd..18043e59 100644 --- a/jobs/sync-characters/sync-characters.go +++ b/jobs/sync-characters/sync-characters.go @@ -13,6 +13,8 @@ import ( func main() { color.Yellow("Syncing characters with Kitsu DB") + + defer color.Green("Finished.") defer arn.Node.Close() kitsuCharacters := kitsu.StreamCharacters() @@ -104,6 +106,4 @@ func main() { // Log fmt.Printf("%s %s %s\n", color.GreenString("✔"), character.ID, character.Name) } - - color.Green("Finished.") } diff --git a/jobs/sync-media-relations/sync-media-relations.go b/jobs/sync-media-relations/sync-media-relations.go index 2a9fca9d..5a7badbd 100644 --- a/jobs/sync-media-relations/sync-media-relations.go +++ b/jobs/sync-media-relations/sync-media-relations.go @@ -12,6 +12,8 @@ import ( func main() { color.Yellow("Syncing media relations with Kitsu DB") + + defer color.Green("Finished.") defer arn.Node.Close() kitsuMediaRelations := kitsu.StreamMediaRelations() @@ -70,6 +72,4 @@ func main() { for _, animeRelations := range relations { animeRelations.Save() } - - color.Green("Finished.") } diff --git a/jobs/sync-shoboi/sync-shoboi.go b/jobs/sync-shoboi/sync-shoboi.go index 6c95f184..1ecc4d42 100644 --- a/jobs/sync-shoboi/sync-shoboi.go +++ b/jobs/sync-shoboi/sync-shoboi.go @@ -10,6 +10,8 @@ import ( func main() { color.Yellow("Syncing Shoboi Anime") + + defer color.Green("Finished.") defer arn.Node.Close() // Priority queues @@ -43,8 +45,6 @@ func main() { // This is a lazy hack: Wait 5 minutes for goroutines to finish their remaining work. time.Sleep(5 * time.Minute) - - color.Green("Finished.") } func refreshQueue(queue []*arn.Anime) { diff --git a/jobs/test/test.go b/jobs/test/test.go index fbf43960..1b55278e 100644 --- a/jobs/test/test.go +++ b/jobs/test/test.go @@ -22,6 +22,8 @@ var packages = []string{ } func main() { + defer color.Green("Finished.") + wg := sync.WaitGroup{} for _, pkg := range packages { diff --git a/jobs/twist/twist.go b/jobs/twist/twist.go index 0a0db580..79ba7a55 100644 --- a/jobs/twist/twist.go +++ b/jobs/twist/twist.go @@ -13,6 +13,7 @@ import ( var rateLimiter = time.NewTicker(500 * time.Millisecond) func main() { + defer color.Green("Finished.") defer arn.Node.Close() // Replace this with ID list from twist.moe later