Skip to content

Commit

Permalink
Add rematch_timeout_config
Browse files Browse the repository at this point in the history
  • Loading branch information
vtm9 committed Nov 1, 2023
1 parent 033ff71 commit 6e6566e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ defmodule Codebattle.Tournament.Base do
|> Enum.map(&Tournament.Player.new!/1)

# TODO: add timeout without blocking server for rematches
:timer.sleep(5000)
timeout_ms = Application.get_env(:codebattle, :tournament_rematch_timeout_ms)
:timer.sleep(timeout_ms)
game_id = create_game(tournament, match_id, players)

match = %Tournament.Match{
Expand Down
1 change: 1 addition & 0 deletions services/app/config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ config :codebattle, fake_html_to_image: false
config :codebattle, use_only_token_auth: false
config :codebattle, show_extension_popup: true
config :codebattle, app_version: System.get_env("APP_VERSION", "dev")
config :codebattle, tournament_rematch_timeout_ms: 5000

config :codebattle,
deployed_at: System.get_env("DEPLOYED_AT") || Calendar.strftime(DateTime.utc_now(), "%c")
Expand Down
4 changes: 4 additions & 0 deletions services/app/config/releases.exs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,16 @@ use_external_js = System.get_env("CODEBATTLE_USE_EXTERNAL_JS") == "true"
use_only_token_auth = System.get_env("CODEBATTLE_USE_ONLY_TOKEN_AUTH") == "true"
show_extension_popup = System.get_env("CODEBATTLE_SHOW_EXTENSION_POPUP") == "true"

tournament_rematch_timeout_ms =
"CODEBATTLE_TOURNAMENT_REMATCH_TIMEOUT_MS" |> System.get_env("5000") |> String.to_integer()

config :codebattle, admins: admins
config :codebattle, import_github_tasks: import_github_tasks
config :codebattle, create_bot_games: create_bot_games
config :codebattle, use_external_js: use_external_js
config :codebattle, use_only_token_auth: use_only_token_auth
config :codebattle, show_extension_popup: show_extension_popup
config :codebattle, tournament_rematch_timeout_ms: tournament_rematch_timeout_ms

config :codebattle, Codebattle.Plugs, rollbar_api_key: System.get_env("ROLLBAR_API_KEY")

Expand Down
1 change: 1 addition & 0 deletions services/app/config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ config :codebattle, ws_port: 4001
config :codebattle, admins: ["admin"]

config :codebattle, freeze_time: true
config :codebattle, tournament_rematch_timeout_ms: 5

config :codebattle, user_rank_server: false
config :codebattle, create_bot_games: false
Expand Down

0 comments on commit 6e6566e

Please sign in to comment.