Commit 405c4007 authored by Howl's avatar Howl
Browse files

Add README and LICENSE

parent c3c3e4f8
Loading
Loading
Loading
Loading

LICENSE

0 → 100644
+19 −0
Changes for LICENSE: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line

Copyright (c) 2015-2016 Giuseppe Guerra and Morgan Bazalgette

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 No newline at end of file

README.md

0 → 100644
+60 −0
Changes for README.md: 60 added lines, 0 removed lines.
Original line number Diff line number Diff line
# 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](https://github.com/osuripple/ripple/blob/master/osu.ppy.sh/cron.php), a terribly performing script. [No, really.](https://y.zxq.co/minzed.jpg) 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

```sh
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:

```go
package main

import (
	"time"

	"github.com/fatih/color"
)

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

	wg.Done()
}
```

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

```go
	if c.TimeConsumingTask {
		fmt.Print("Starting time consuming task...")
		wg.Add(1)
		go opTimeConsumingTask()
		color.Green(" ok!")
	}
```

## License

MIT