seperated gamemodes into seprate tables
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Philipp 2021-09-22 14:12:49 +02:00
parent f85fb7434d
commit 9dae1ca401
8 changed files with 210 additions and 17 deletions

View file

@ -22,7 +22,7 @@ type Server struct {
}
func main() {
dsn := "postgres://postgres:secret@postgres:5432/postgres?sslmode=disable"
dsn := "postgres://postgres:secret@u0k.de:5432/postgres?sslmode=disable"
store, err := postgres.NewStore(dsn)
if err != nil {
@ -32,13 +32,13 @@ func main() {
ss, err := store.Servers()
if err != nil {
log.Fatal("There is no server in the list.")
log.Fatal("There is an issue with the databse: %w", err)
}
for _, s := range ss {
serverString := s.ServerIP
c := cron.New()
c.AddFunc("*/5 * * * *", func() { updateServers(serverString, store) })
c.AddFunc("*/1 * * * *", func() { updateServers(serverString, store) })
c.Start()
}
@ -48,10 +48,10 @@ func main() {
}
func updateServers(serverString string, store steamServer.Store) {
url := "http://steam-server-api:8080/server/" + serverString
url := "http://localhost:8090/server/" + serverString
reqClient := http.Client {
Timeout: time.Second * 2,
Timeout: time.Second * 10,
}
req, err := http.NewRequest(http.MethodGet, url, nil)