Skip to content
Snippets Groups Projects
Verified Commit c3f9e24c authored by dashie's avatar dashie
Browse files

Use a variable for stats to avoid double call

parent 724f096a
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,8 @@ def schemas(conn, _params) do
# Schema definition: https://github.com/jhass/nodeinfo/blob/master/schemas/2.0/schema.json
def nodeinfo(conn, %{"version" => "2.0"}) do
stats = Stats.get_stats()
response = %{
version: "2.0",
software: %{
......@@ -36,9 +38,9 @@ def nodeinfo(conn, %{"version" => "2.0"}) do
openRegistrations: Keyword.get(@instance, :registrations_open),
usage: %{
users: %{
total: Stats.get_stats().user_count || 0
total: stats.user_count || 0
},
localPosts: Stats.get_stats().status_count || 0
localPosts: stats.status_count || 0
},
metadata: %{
nodeName: Keyword.get(@instance, :name)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment