aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/main.go
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-07 22:14:51 +0900
committernsfisis <nsfisis@gmail.com>2024-08-08 04:02:37 +0900
commit6bb6071ec1dce0cce59df0cb1c38168918061041 (patch)
treefeca06471f51ac5a1cdaaed4a0333ee9c0cf38e3 /backend/main.go
parent401a28944fc0408811aedadd1c3104e2e2d4d7fe (diff)
downloadiosdc-japan-2025-albatross-6bb6071ec1dce0cce59df0cb1c38168918061041.tar.gz
iosdc-japan-2025-albatross-6bb6071ec1dce0cce59df0cb1c38168918061041.tar.zst
iosdc-japan-2025-albatross-6bb6071ec1dce0cce59df0cb1c38168918061041.zip
refactor(backend): move ownership of channel to send task results
Diffstat (limited to 'backend/main.go')
-rw-r--r--backend/main.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/backend/main.go b/backend/main.go
index e3d0052..62499d6 100644
--- a/backend/main.go
+++ b/backend/main.go
@@ -61,8 +61,9 @@ func main() {
e.Use(middleware.Recover())
taskQueue := taskqueue.NewQueue("task-db:6379")
+ workerServer := taskqueue.NewWorkerServer("task-db:6379", queries)
- gameHubs := game.NewGameHubs(queries, taskQueue)
+ gameHubs := game.NewGameHubs(queries, taskQueue, workerServer.Results())
err = gameHubs.RestoreFromDB(ctx)
if err != nil {
log.Fatalf("Error restoring game hubs from db %v", err)
@@ -95,9 +96,8 @@ func main() {
return c.Redirect(http.StatusPermanentRedirect, "http://localhost:5173/logout")
})
- gameHubs.Run()
+ go gameHubs.Run()
- workerServer := taskqueue.NewWorkerServer("task-db:6379", queries, gameHubs.C())
go func() {
workerServer.Run()
}()