Loading cron.go +6 −0 Original line number Original line Diff line number Diff line Loading @@ -35,6 +35,7 @@ type config struct { RemoveDonorOnExpired bool RemoveDonorOnExpired bool FixMultipleCompletedScores bool `description:"Set completed=2 if multiple completed=3 scores for same beatmap and user are present."` FixMultipleCompletedScores bool `description:"Set completed=2 if multiple completed=3 scores for same beatmap and user are present."` ClearExpiredProfileBackgrounds bool ClearExpiredProfileBackgrounds bool DeleteOldPrivateTokens bool `description:"Whether to delete old private (private = 1) API tokens (older than a month)"` Workers int `description:"The number of goroutines which should execute queries. Increasing it may make cron faster, depending on your system."` Workers int `description:"The number of goroutines which should execute queries. Increasing it may make cron faster, depending on your system."` } } Loading Loading @@ -128,6 +129,11 @@ func main() { beatmaps.ranked != '4';`) beatmaps.ranked != '4';`) color.Green(" ok!") color.Green(" ok!") } } if c.DeleteOldPrivateTokens { fmt.Println("Starting deleting old private API tokens") go op(`DELETE FROM tokens WHERE private = 1 AND last_updated < ?`, time.Now().Add(-time.Hour*24*30)) color.Green(" ok!") } if c.UnrankScoresOnInvalidBeatmaps { if c.UnrankScoresOnInvalidBeatmaps { fmt.Print("Unranking scores on invalid beatmaps...") fmt.Print("Unranking scores on invalid beatmaps...") go op(`DELETE scores.* FROM scores go op(`DELETE scores.* FROM scores Loading Loading
cron.go +6 −0 Original line number Original line Diff line number Diff line Loading @@ -35,6 +35,7 @@ type config struct { RemoveDonorOnExpired bool RemoveDonorOnExpired bool FixMultipleCompletedScores bool `description:"Set completed=2 if multiple completed=3 scores for same beatmap and user are present."` FixMultipleCompletedScores bool `description:"Set completed=2 if multiple completed=3 scores for same beatmap and user are present."` ClearExpiredProfileBackgrounds bool ClearExpiredProfileBackgrounds bool DeleteOldPrivateTokens bool `description:"Whether to delete old private (private = 1) API tokens (older than a month)"` Workers int `description:"The number of goroutines which should execute queries. Increasing it may make cron faster, depending on your system."` Workers int `description:"The number of goroutines which should execute queries. Increasing it may make cron faster, depending on your system."` } } Loading Loading @@ -128,6 +129,11 @@ func main() { beatmaps.ranked != '4';`) beatmaps.ranked != '4';`) color.Green(" ok!") color.Green(" ok!") } } if c.DeleteOldPrivateTokens { fmt.Println("Starting deleting old private API tokens") go op(`DELETE FROM tokens WHERE private = 1 AND last_updated < ?`, time.Now().Add(-time.Hour*24*30)) color.Green(" ok!") } if c.UnrankScoresOnInvalidBeatmaps { if c.UnrankScoresOnInvalidBeatmaps { fmt.Print("Unranking scores on invalid beatmaps...") fmt.Print("Unranking scores on invalid beatmaps...") go op(`DELETE scores.* FROM scores go op(`DELETE scores.* FROM scores Loading