From 01d8df0a7f37f99ff251a2ea816c09e3a136a0ff Mon Sep 17 00:00:00 2001 From: dovixman Date: Thu, 14 Nov 2024 16:20:37 +0100 Subject: [PATCH] add 5 second timeout to initialState call instead of using the turn timeout --- internal/engine/game/initialstate.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/engine/game/initialstate.go b/internal/engine/game/initialstate.go index ad81997..bfd7ad7 100644 --- a/internal/engine/game/initialstate.go +++ b/internal/engine/game/initialstate.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "time" "github.com/jonasdacruz/lighthouses_aicontest/internal/engine/lighthouse" "github.com/jonasdacruz/lighthouses_aicontest/internal/engine/player" @@ -57,7 +58,8 @@ func (e *Game) SendInitialState() { panic(err) } - ctx, cancel := context.WithTimeout(context.Background(), viper.GetDuration("turn_request_timeout")) + // Add 5 seconds timeout to the InitialState call + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() // sending initial state to player