Skip to content

Commit

Permalink
add 5 second timeout to initialState call instead of using the turn t…
Browse files Browse the repository at this point in the history
…imeout
  • Loading branch information
dovixman committed Nov 14, 2024
1 parent e133f9b commit 01d8df0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/engine/game/initialstate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 01d8df0

Please sign in to comment.