Fix pubkey #4

Merged
Simponic merged 3 commits from fix_pubkey into main 2023-01-13 23:18:34 -05:00
2 changed files with 13 additions and 8 deletions
Showing only changes of commit a607da7918 - Show all commits

View File

@ -15,7 +15,7 @@ config :chessh, RateLimits,
jail_timeout_ms: 5 * 60 * 1000, jail_timeout_ms: 5 * 60 * 1000,
jail_attempt_threshold: 15, jail_attempt_threshold: 15,
max_concurrent_user_sessions: 5, max_concurrent_user_sessions: 5,
player_session_message_burst_ms: 1_000, player_session_message_burst_ms: 500,
player_session_message_burst_rate: 8 player_session_message_burst_rate: 8
import_config "#{config_env()}.exs" import_config "#{config_env()}.exs"

View File

@ -14,7 +14,7 @@ defmodule Chessh.PlayerSession do
def changeset(player_session, attrs) do def changeset(player_session, attrs) do
player_session player_session
|> cast(attrs, [:login]) |> cast(attrs, [:login, :node_id, :process])
end end
def concurrent_sessions(player) do def concurrent_sessions(player) do
@ -58,12 +58,17 @@ defmodule Chessh.PlayerSession do
"Creating session for player #{username} on node #{System.fetch_env!("NODE_ID")} with process #{inspect(self())}" "Creating session for player #{username} on node #{System.fetch_env!("NODE_ID")} with process #{inspect(self())}"
) )
Repo.insert(%PlayerSession{ now = DateTime.utc_now()
login: DateTime.utc_now(),
Repo.insert!(
%PlayerSession{
login: now,
node_id: System.fetch_env!("NODE_ID"), node_id: System.fetch_env!("NODE_ID"),
player: player, player: player,
process: Utils.pid_to_str(self()) process: Utils.pid_to_str(self())
}) },
on_conflict: :nothing
)
concurrent_sessions = PlayerSession.concurrent_sessions(player) concurrent_sessions = PlayerSession.concurrent_sessions(player)