Skip to content

Commit

Permalink
List cache is used by several others
Browse files Browse the repository at this point in the history
So instantiate this cache first, and setup the initial value where it's
required, module by module.
  • Loading branch information
geekingfrog committed Jul 27, 2024
1 parent 67495ed commit 53cbc2b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/teiserver/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ defmodule Teiserver.Application do
# Store refers to something that is typically only updated at startup
# and should not be clustered

concache_sup(:lists),
concache_sup(:codes),
concache_sup(:account_user_cache),
concache_sup(:account_user_cache_bang),
Expand Down
4 changes: 1 addition & 3 deletions lib/teiserver/data/matchmaking_cache.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ defmodule Teiserver.Data.MatchmakingCache do
def start_link(opts) do
with {:ok, sup} <- Supervisor.start_link(__MODULE__, :ok, opts) do
Teiserver.cache_put(:lists, :rooms, [])
Teiserver.cache_put(:lists, :lobby_policies, [])
Teiserver.Data.Matchmaking.pre_cache_queues()

{:ok, sup}
Expand All @@ -19,8 +18,7 @@ defmodule Teiserver.Data.MatchmakingCache do
@impl true
def init(:ok) do
children = [
CacheHelper.concache_perm_sup(:teiserver_queues),
CacheHelper.concache_perm_sup(:lists)
CacheHelper.concache_perm_sup(:teiserver_queues)
]

Supervisor.init(children, strategy: :one_for_all)
Expand Down
1 change: 1 addition & 0 deletions lib/teiserver/game/libs/lobby_policy_cache.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ defmodule Teiserver.Data.LobbyPolicyCache do

def start_link(opts) do
with {:ok, sup} <- Supervisor.start_link(__MODULE__, :ok, opts) do
Teiserver.cache_put(:lists, :lobby_policies, [])
Teiserver.Game.pre_cache_policies()
{:ok, sup}
end
Expand Down

0 comments on commit 53cbc2b

Please sign in to comment.