2017-06-20 15:58:55 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2017-10-17 14:23:48 +02:00
|
|
|
"os"
|
|
|
|
"os/signal"
|
2017-09-28 15:43:21 +02:00
|
|
|
"runtime/debug"
|
2017-06-20 15:58:55 +02:00
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2018-09-06 15:02:21 +02:00
|
|
|
const version = "1.1.7"
|
|
|
|
|
2017-06-20 15:58:55 +02:00
|
|
|
func main() {
|
2017-09-28 15:43:21 +02:00
|
|
|
// Force garbage collection
|
|
|
|
go func() {
|
2017-09-28 19:18:01 +02:00
|
|
|
for _ = range time.Tick(10 * time.Second) {
|
2017-09-28 15:43:21 +02:00
|
|
|
debug.FreeOSMemory()
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
2018-09-10 08:17:00 +02:00
|
|
|
s := startServer()
|
2017-06-20 15:58:55 +02:00
|
|
|
|
2017-10-17 14:23:48 +02:00
|
|
|
stop := make(chan os.Signal, 1)
|
|
|
|
signal.Notify(stop, os.Interrupt, os.Kill)
|
2017-06-20 15:58:55 +02:00
|
|
|
|
2017-10-17 14:23:48 +02:00
|
|
|
<-stop
|
|
|
|
|
|
|
|
shutdownServer(s)
|
2018-09-10 08:17:00 +02:00
|
|
|
shutdownVips()
|
2017-06-20 15:58:55 +02:00
|
|
|
}
|