Improved background jobs
This commit is contained in:
@ -1,35 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/fatih/color"
|
||||
)
|
||||
|
||||
func main() {
|
||||
color.Yellow("Updating user references")
|
||||
|
||||
arn.DB.DeleteTable("NickToUser")
|
||||
arn.DB.DeleteTable("EmailToUser")
|
||||
|
||||
// Get a stream of all anime
|
||||
allUsers, err := arn.AllUsers()
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Iterate over the stream
|
||||
count := 0
|
||||
for user := range allUsers {
|
||||
count++
|
||||
println(count, user.Nick)
|
||||
|
||||
user.SetNick(user.Nick)
|
||||
|
||||
if user.Email != "" {
|
||||
user.SetEmail(user.Email)
|
||||
}
|
||||
}
|
||||
|
||||
color.Green("Finished.")
|
||||
}
|
Reference in New Issue
Block a user