formatting
This commit is contained in:
parent
9cf19af0a0
commit
1c0d0fcd8d
|
@ -14,13 +14,13 @@ config :vonbraun, Vonbraun.Cache,
|
||||||
# GC max timeout: 10 min
|
# GC max timeout: 10 min
|
||||||
gc_cleanup_max_timeout: :timer.minutes(10)
|
gc_cleanup_max_timeout: :timer.minutes(10)
|
||||||
|
|
||||||
#config :vonbraun,
|
# config :vonbraun,
|
||||||
# json_ld: %{
|
# json_ld: %{
|
||||||
# "https://www.w3.org/ns/activitystreams" =>
|
# "https://www.w3.org/ns/activitystreams" =>
|
||||||
# File.read!(Path.join(Path.dirname(__DIR__), "priv/jsonld/activitystreams.json"))
|
# File.read!(Path.join(Path.dirname(__DIR__), "priv/jsonld/activitystreams.json"))
|
||||||
# }
|
# }
|
||||||
|
|
||||||
config :vonbraun,
|
config :vonbraun,
|
||||||
json_ld: %{}
|
json_ld: %{}
|
||||||
|
|
||||||
import_config "#{Mix.env()}.exs"
|
import_config "#{Mix.env()}.exs"
|
||||||
|
|
|
@ -135,7 +135,7 @@ defmodule Vonbraun.Control do
|
||||||
document_loader: Vonbraun.JSONLD.DocumentLoaderAgent
|
document_loader: Vonbraun.JSONLD.DocumentLoaderAgent
|
||||||
)
|
)
|
||||||
|
|
||||||
Logger.debug(("Here is the expanded activity:\n#{Jason.encode!(expanded_activity)}"))
|
Logger.debug("Here is the expanded activity:\n#{Jason.encode!(expanded_activity)}")
|
||||||
|
|
||||||
activity
|
activity
|
||||||
end
|
end
|
||||||
|
|
|
@ -76,13 +76,13 @@ defmodule Vonbraun.JSONLD.DocumentLoaderAgent do
|
||||||
Logger.debug("Attempting to load JSON-LD context: #{url}")
|
Logger.debug("Attempting to load JSON-LD context: #{url}")
|
||||||
|
|
||||||
with {:cache, nil} <- {:cache, Agent.get(__MODULE__, fn state -> Map.get(state, url) end)},
|
with {:cache, nil} <- {:cache, Agent.get(__MODULE__, fn state -> Map.get(state, url) end)},
|
||||||
:ok <- Logger.debug("No cached JSON-LD context, so querying"),
|
:ok <- Logger.debug("No cached JSON-LD context, so querying"),
|
||||||
{:get, {:ok, body}} <-
|
{:get, {:ok, body}} <-
|
||||||
{:get, http_get(url)},
|
{:get, http_get(url)},
|
||||||
{:data, data} <- {:data, %RemoteDocument{document: body, document_url: url}},
|
{:data, data} <- {:data, %RemoteDocument{document: body, document_url: url}},
|
||||||
{:update, :ok} <-
|
{:update, :ok} <-
|
||||||
{:update, Agent.update(__MODULE__, fn state -> Map.put(state, url, {:ok, data}) end)} do
|
{:update, Agent.update(__MODULE__, fn state -> Map.put(state, url, {:ok, data}) end)} do
|
||||||
Logger.debug("Got remote one, so returning it.")
|
Logger.debug("Got remote one, so returning it.")
|
||||||
{:ok, data}
|
{:ok, data}
|
||||||
else
|
else
|
||||||
{:cache, response} ->
|
{:cache, response} ->
|
||||||
|
|
Loading…
Reference in New Issue