forked from AkkomaGang/akkoma
Use a variable for stats to avoid double call
This commit is contained in:
parent
724f096ac7
commit
c3f9e24c70
1 changed files with 4 additions and 2 deletions
|
@ -22,6 +22,8 @@ def schemas(conn, _params) do
|
||||||
|
|
||||||
# Schema definition: https://github.com/jhass/nodeinfo/blob/master/schemas/2.0/schema.json
|
# Schema definition: https://github.com/jhass/nodeinfo/blob/master/schemas/2.0/schema.json
|
||||||
def nodeinfo(conn, %{"version" => "2.0"}) do
|
def nodeinfo(conn, %{"version" => "2.0"}) do
|
||||||
|
stats = Stats.get_stats()
|
||||||
|
|
||||||
response = %{
|
response = %{
|
||||||
version: "2.0",
|
version: "2.0",
|
||||||
software: %{
|
software: %{
|
||||||
|
@ -36,9 +38,9 @@ def nodeinfo(conn, %{"version" => "2.0"}) do
|
||||||
openRegistrations: Keyword.get(@instance, :registrations_open),
|
openRegistrations: Keyword.get(@instance, :registrations_open),
|
||||||
usage: %{
|
usage: %{
|
||||||
users: %{
|
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: %{
|
metadata: %{
|
||||||
nodeName: Keyword.get(@instance, :name)
|
nodeName: Keyword.get(@instance, :name)
|
||||||
|
|
Loading…
Reference in a new issue