Added new background jobs
This commit is contained in:
parent
771c16066a
commit
367d31aadb
@ -29,7 +29,10 @@ var jobs = map[string]time.Duration{
|
||||
"airing-anime": 10 * time.Minute,
|
||||
"popular-anime": 20 * time.Minute,
|
||||
"avatars": 30 * time.Minute,
|
||||
"sync-shoboi": 8 * time.Hour,
|
||||
"refresh-episodes": 10 * time.Hour,
|
||||
"refresh-track-titles": 10 * time.Hour,
|
||||
"refresh-osu": 12 * time.Hour,
|
||||
"sync-anime": 12 * time.Hour,
|
||||
"search-index": 12 * time.Hour,
|
||||
}
|
||||
|
27
jobs/refresh-osu/refresh-osu.go
Normal file
27
jobs/refresh-osu/refresh-osu.go
Normal 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.")
|
||||
}
|
Loading…
Reference in New Issue
Block a user