1
0
mirror of https://git.pleroma.social/sjw/pleroma.git synced 2024-12-27 21:45:25 +01:00

Use a variable for stats to avoid double call

This commit is contained in:
Dashie 2018-05-03 15:31:39 +02:00
parent 724f096ac7
commit c3f9e24c70
No known key found for this signature in database
GPG Key ID: C2D57B325840B755

View File

@ -22,6 +22,8 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController 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 @@ defmodule Pleroma.Web.Nodeinfo.NodeinfoController 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)