Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Minor changes to user_daily_visits #10324

Merged
merged 4 commits into from
Jul 8, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/10324.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Minor change to the code that populates `user_daily_visits`.
4 changes: 2 additions & 2 deletions synapse/storage/databases/main/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def _get_start_of_day(self):
"""
Returns millisecond unixtime for start of UTC day.
"""
now = time.gmtime()
now = time.gmtime(self.hs.get_clock().time())
reivilibre marked this conversation as resolved.
Show resolved Hide resolved
today_start = calendar.timegm((now.tm_year, now.tm_mon, now.tm_mday, 0, 0, 0))
return today_start * 1000

Expand Down Expand Up @@ -352,7 +352,7 @@ def _generate_user_daily_visits(txn):
) udv
ON u.user_id = udv.user_id AND u.device_id=udv.device_id
INNER JOIN users ON users.name=u.user_id
WHERE last_seen > ? AND last_seen <= ?
WHERE ? <= last_seen AND last_seen < ?
AND udv.timestamp IS NULL AND users.is_guest=0
AND users.appservice_id IS NULL
GROUP BY u.user_id, u.device_id
Expand Down