projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
object containment: handle all cases where ID is invalid (missing, nil, non-string)
[akkoma]
/
lib
/
pleroma
/
stats.ex
diff --git
a/lib/pleroma/stats.ex
b/lib/pleroma/stats.ex
index a3b8a4d669783e6c19b4a56f78c39e6eb394a1d6..8154a09b754a75b36d72b8e01700f0f2612cec7f 100644
(file)
--- a/
lib/pleroma/stats.ex
+++ b/
lib/pleroma/stats.ex
@@
-32,7
+32,7
@@
defmodule Pleroma.Stats do
end
def init(args) do
end
def init(args) do
- Process.send
_after(self(), :run_update, @interval
)
+ Process.send
(self(), :run_update, []
)
{:ok, args}
end
{:ok, args}
end
@@
-68,12
+68,7
@@
defmodule Pleroma.Stats do
domain_count = Enum.count(peers)
domain_count = Enum.count(peers)
- status_query =
- from(u in User.Query.build(%{local: true}),
- select: fragment("sum((?->>'note_count')::int)", u.info)
- )
-
- status_count = Repo.one(status_query)
+ status_count = Repo.aggregate(User.Query.build(%{local: true}), :sum, :note_count)
user_count = Repo.aggregate(User.Query.build(%{local: true, active: true}), :count, :id)
user_count = Repo.aggregate(User.Query.build(%{local: true, active: true}), :count, :id)