Ripple's cron script
Find a file
2019-05-17 20:19:50 +02:00
.gitignore Initial commit 2016-04-17 11:30:04 +02:00
cache_data.go I hate mysql 2019-05-17 20:19:50 +02:00
calculate_accuracy.go Revert "Chunk queries instead of loading all data" 2018-03-22 21:09:50 +01:00
calculate_overall_accuracy.go ho ho ho what will it be? 2017-12-30 21:55:24 +01:00
calculate_pp.go Calculate pp only for pp-enabled beatmaps 2018-11-19 23:10:03 +01:00
cron.go CachePlayTime 2019-05-16 23:56:55 +02:00
fix_multiple_completed_scores.go Make cron shut up a bit 2016-12-10 16:44:52 +01:00
fix_score_duplicates.go ... 2018-02-16 03:49:58 +01:00
hanayo.go set online users 2016-12-10 16:40:13 +01:00
LICENSE Update LICENSE and README 2016-08-01 10:46:04 +02:00
README.md ... 2018-02-16 03:47:52 +01:00
redis.go ho ho ho what will it be? 2017-12-30 21:55:24 +01:00
replays.go Forgot to remove the actual files 🤔 2017-05-28 21:23:32 +02:00

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: https://asciinema.org/a/42583 (watch the video especially for the last 30 seconds, as you can see the true power of 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.