diff options
Diffstat (limited to 'backend/main.go')
| -rw-r--r-- | backend/main.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/backend/main.go b/backend/main.go index e2e4bbd..a213c6c 100644 --- a/backend/main.go +++ b/backend/main.go @@ -15,6 +15,7 @@ import ( "github.com/nsfisis/iosdc-japan-2024-albatross/backend/api" "github.com/nsfisis/iosdc-japan-2024-albatross/backend/db" "github.com/nsfisis/iosdc-japan-2024-albatross/backend/game" + "github.com/nsfisis/iosdc-japan-2024-albatross/backend/taskqueue" ) func connectDB(ctx context.Context, dsn string) (*pgxpool.Pool, error) { @@ -59,7 +60,10 @@ func main() { e.Use(middleware.Logger()) e.Use(middleware.Recover()) - gameHubs := game.NewGameHubs(queries) + taskQueue := taskqueue.NewQueue("task-db:6379") + workerServer := taskqueue.NewWorkerServer("task-db:6379") + + gameHubs := game.NewGameHubs(queries, taskQueue) err = gameHubs.RestoreFromDB(ctx) if err != nil { log.Fatalf("Error restoring game hubs from db %v", err) @@ -94,6 +98,10 @@ func main() { gameHubs.Run() + go func() { + workerServer.Run() + }() + if err := e.Start(":80"); err != http.ErrServerClosed { log.Fatal(err) } |
