Ripple's cron script https://ripple.moe

Morgan Bazalgette 5520374db0 Save number of users in country in hanayo:country_list 1 week ago
.gitignore 0dd4d6f197 Initial commit 1 year ago
LICENSE 16b71bff14 Update LICENSE and README 8 months ago
README.md 7463a7ee4c Use zxq.co instead of git.zxq.co 2 weeks ago
cache_data.go 7463a7ee4c Use zxq.co instead of git.zxq.co 2 weeks ago
calculate_accuracy.go 19f2e7edc4 As usual output is starting to get big, default output must now be enabled with -v 8 months ago
calculate_overall_accuracy.go 2250374798 PP on mania hype? 9 months ago
calculate_pp.go 247e33531c Change CalculateLeaderboard into PopulateRedis 1 week ago
cron.go 247e33531c Change CalculateLeaderboard into PopulateRedis 1 week ago
fix_multiple_completed_scores.go 4b93dee3d5 Make cron shut up a bit 4 months ago
fix_score_duplicates.go 4b93dee3d5 Make cron shut up a bit 4 months ago
hanayo.go 8e5a10c87f set online users 4 months ago
haspp.go 2250374798 PP on mania hype? 9 months ago
redis.go 5520374db0 Save number of users in country in hanayo:country_list 1 week ago
replays.go 19f2e7edc4 As usual output is starting to get big, default output must now be enabled with -v 8 months ago

README.md

ripple-cron-go

The fastest cron for ripple you'll never need.

A bit of explaination here:

Ripple uses a cronjob to fix any eventual errors in the database. For doing it, it used cron.php, a terribly performing script. No, really. That's three minutes of server CPU being used at 100%!

So I decided to rewrite it to be better performant, and what better language to do it if not Go (well, C, C++ and Assembly are indeed faster, but I'm not on that level of insanity).

This is the result:#42583 (watch the video especially for the last 30 seconds, as you can see the true power of ripple-cron-go).

  • Origin: https://zxq.co/ripple/ripple-cron-go
  • Mirror: https://github.com/osuripple/ripple-cron-go

Installing

Assuming you have Go installed and your GOPATH set up

go get -u github.com/osuripple/ripple-cron-go
cd $GOPATH/src/github.com/osuripple/ripple-cron-go
go build
./ripple-cron-go
nano cron.conf
./ripple-cron-go # Boom!

Extending

This is an example of a very simple unit of ripple-cron-go:

package main

import (
	"time"

	"github.com/fatih/color"
)

func opTimeConsumingTask() {
	defer wg.Done()

	time.Sleep(time.Second)
	color.Green("> TimeConsumingTask: done!", count)
}

Then you would add a bool in the config struct to enable/disable the task, then this to cron.go (cron.go contains main())

	if c.TimeConsumingTask {
		verboseln("Starting time consuming task...")
		wg.Add(1)
		go opTimeConsumingTask()
	}

License

All code in this repository is licensed under the GNU AGPL 3 License.
See the "LICENSE" file for more information.