reduce caching
This commit is contained in:
parent
d75a8e75c6
commit
d88adf4293
2 changed files with 8 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue