main.go 376 B

1234567891011121314151617181920212223242526272829
  1. package main
  2. import (
  3. "os"
  4. "os/signal"
  5. "runtime/debug"
  6. "time"
  7. )
  8. const version = "1.1.7"
  9. func main() {
  10. // Force garbage collection
  11. go func() {
  12. for _ = range time.Tick(10 * time.Second) {
  13. debug.FreeOSMemory()
  14. }
  15. }()
  16. s := startServer()
  17. stop := make(chan os.Signal, 1)
  18. signal.Notify(stop, os.Interrupt, os.Kill)
  19. <-stop
  20. shutdownServer(s)
  21. shutdownVips()
  22. }