fix: Fix connections remove timeouts

This commit is contained in:
Dmitry Popov
2025-01-11 09:39:55 +01:00
parent 5a4d819622
commit 7ff9689b76
2 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ defmodule WandererApp.Env do
cache: WandererApp.Cache,
key: "map-connection-auto-expire-hours"
)
def map_connection_auto_expire_hours, do: get_key(:map_connection_auto_eol_hours)
def map_connection_auto_expire_hours, do: get_key(:map_connection_auto_expire_hours)
@decorate cacheable(
cache: WandererApp.Cache,
@@ -82,12 +82,14 @@ defmodule WandererApp.Map.Server.ConnectionsImpl do
:timer.minutes(get_eol_expire_timeout_mins())
def init_eol_cache(map_id, connections_eol_time) do
eol_expire_timeout = get_eol_expire_timeout()
connections_eol_time
|> Enum.each(fn {connection_id, connection_eol_time} ->
WandererApp.Cache.put(
"map_#{map_id}:conn_#{connection_id}:mark_eol_time",
connection_eol_time,
ttl: get_eol_expire_timeout()
ttl: eol_expire_timeout
)
end)
end
@@ -201,8 +203,8 @@ defmodule WandererApp.Map.Server.ConnectionsImpl do
do: update_connection(state, :update_custom_info, [:custom_info], connection_update)
def cleanup_connections(%{map_id: map_id} = state) do
connection_auto_eol_hours = get_connection_auto_eol_hours()
connection_auto_expire_hours = get_connection_auto_expire_hours()
connection_auto_eol_hours = get_connection_auto_eol_hours()
state =
map_id