cloud-game/cmd/overworker/main.go
giongto35 fde4a24158
Merge aspect ratio to master (#116)
* Add frame scaling support (#107)

* Update README.md with additional info about Windows builds

* Add frame scaling

* Add and enable bilinear scaling (#109)

* Add and enable bilinear scaling

* Use Go x/image lib for interpolation

* Reformat the code goimport/gofmt

* Move worker config into the pkg/worker directory

* Change separator in the save file path allowing it to work on Windows (#113)
2019-10-19 02:29:07 +08:00

45 lines
905 B
Go

package main
import (
"context"
"math/rand"
"os"
"os/signal"
"time"
config "github.com/giongto35/cloud-game/pkg/config/worker"
"github.com/giongto35/cloud-game/pkg/util/logging"
"github.com/giongto35/cloud-game/pkg/worker"
"github.com/golang/glog"
"github.com/spf13/pflag"
)
func main() {
rand.Seed(time.Now().UTC().UnixNano())
cfg := config.NewDefaultConfig()
cfg.AddFlags(pflag.CommandLine)
logging.Init()
defer logging.Flush()
ctx, cancelCtx := context.WithCancel(context.Background())
glog.Infof("Initializing worker server")
glog.V(4).Infof("Worker configs %v", cfg)
o := worker.New(ctx, cfg)
if err := o.Run(); err != nil {
glog.Errorf("Failed to run worker, reason %v", err)
os.Exit(1)
}
stop := make(chan os.Signal, 1)
signal.Notify(stop, os.Interrupt)
select {
case <-stop:
glog.Infoln("Received SIGTERM, Quiting Worker")
o.Shutdown()
cancelCtx()
}
}