reduce caching

This commit is contained in:
Graham McIntire 2025-07-11 14:42:01 -05:00
parent d75a8e75c6
commit d88adf4293
No known key found for this signature in database
2 changed files with 8 additions and 5 deletions

View file

@ -7,10 +7,10 @@ defmodule Aprsme.CachedQueries do
alias Aprsme.Packets
alias Aprsme.Repo
# 2 minutes for frequently changing data
@cache_ttl_short to_timeout(minute: 2)
# 15 minutes for moderately changing data
@cache_ttl_medium to_timeout(minute: 15)
# 1 minute for frequently changing data
@cache_ttl_short to_timeout(minute: 1)
# 1 minute for moderately changing data
@cache_ttl_medium to_timeout(minute: 1)
@doc """
Get recent packets with caching

View file

@ -89,7 +89,10 @@ defmodule AprsmeWeb.Plugs.IPGeolocation do
ip_from_remote =
case conn.remote_ip do
{a, b, c, d} -> "#{a}.#{b}.#{c}.#{d}"
{a, b, c, d, e, f, g, h} -> "#{a}:#{b}:#{c}:#{d}:#{e}:#{f}:#{g}:#{h}"
{a, b, c, d, e, f, g, h} ->
# Convert IPv6 tuple to proper IPv6 format
:inet.ntoa({a, b, c, d, e, f, g, h})
|> to_string()
_ -> nil
end