Added new background jobs

This commit is contained in:
Eduard Urbach 2017-07-02 15:11:42 +02:00
parent 771c16066a
commit 367d31aadb
2 changed files with 30 additions and 0 deletions

View File

@ -29,7 +29,10 @@ var jobs = map[string]time.Duration{
"airing-anime": 10 * time.Minute, "airing-anime": 10 * time.Minute,
"popular-anime": 20 * time.Minute, "popular-anime": 20 * time.Minute,
"avatars": 30 * time.Minute, "avatars": 30 * time.Minute,
"sync-shoboi": 8 * time.Hour,
"refresh-episodes": 10 * time.Hour,
"refresh-track-titles": 10 * time.Hour, "refresh-track-titles": 10 * time.Hour,
"refresh-osu": 12 * time.Hour,
"sync-anime": 12 * time.Hour, "sync-anime": 12 * time.Hour,
"search-index": 12 * time.Hour, "search-index": 12 * time.Hour,
} }

View File

@ -0,0 +1,27 @@
package main
import (
"time"
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
color.Yellow("Refreshing osu information")
ticker := time.NewTicker(500 * time.Millisecond)
for user := range arn.MustStreamUsers() {
// Get osu info
if user.RefreshOsuInfo() == nil {
arn.PrettyPrint(user.Accounts.Osu)
user.Save()
}
// Wait for rate limiter
<-ticker.C
}
color.Green("Finished.")
}