Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
a74b25fa
Commit
a74b25fa
authored
6 years ago
by
Neil Johnson
Browse files
Options
Downloads
Patches
Plain Diff
WIP building out mau reserved users
parent
fbe255f9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/storage/monthly_active_users.py
+15
-1
15 additions, 1 deletion
synapse/storage/monthly_active_users.py
with
15 additions
and
1 deletion
synapse/storage/monthly_active_users.py
+
15
−
1
View file @
a74b25fa
...
@@ -19,16 +19,30 @@ from synapse.util.caches.descriptors import cached
...
@@ -19,16 +19,30 @@ from synapse.util.caches.descriptors import cached
from
._base
import
SQLBaseStore
from
._base
import
SQLBaseStore
# Number of msec of granularity to store the monthly_active_user timestamp
# Number of msec of granularity to store the monthly_active_user timestamp
# This means it is not necessary to update the table on every request
# This means it is not necessary to update the table on every request
LAST_SEEN_GRANULARITY
=
60
*
60
*
1000
LAST_SEEN_GRANULARITY
=
60
*
60
*
1000
class
MonthlyActiveUsersStore
(
SQLBaseStore
):
class
MonthlyActiveUsersStore
(
SQLBaseStore
):
@defer.inlineCallbacks
def
__init__
(
self
,
dbconn
,
hs
):
def
__init__
(
self
,
dbconn
,
hs
):
super
(
MonthlyActiveUsersStore
,
self
).
__init__
(
None
,
hs
)
super
(
MonthlyActiveUsersStore
,
self
).
__init__
(
None
,
hs
)
self
.
_clock
=
hs
.
get_clock
()
self
.
_clock
=
hs
.
get_clock
()
self
.
hs
=
hs
self
.
hs
=
hs
threepids
=
self
.
hs
.
config
.
mau_limits_reserved_threepids
self
.
reserved_user_ids
=
set
()
for
tp
in
threepids
:
user_id
=
yield
hs
.
get_datastore
().
get_user_id_by_threepid
(
tp
[
"
medium
"
],
tp
[
"
address
"
]
)
if
user_id
:
self
.
reserved_user_ids
.
add
(
user_id
)
else
:
logger
.
warning
(
"
mau limit reserved threepid %s not found in db
"
%
tp
)
def
reap_monthly_active_users
(
self
):
def
reap_monthly_active_users
(
self
):
"""
"""
...
@@ -78,7 +92,7 @@ class MonthlyActiveUsersStore(SQLBaseStore):
...
@@ -78,7 +92,7 @@ class MonthlyActiveUsersStore(SQLBaseStore):
@cached
(
num_args
=
0
)
@cached
(
num_args
=
0
)
def
get_monthly_active_count
(
self
):
def
get_monthly_active_count
(
self
):
"""
Generates current count of monthly active users
.abs
"""
Generates current count of monthly active users
Returns:
Returns:
Defered[int]: Number of current monthly active users
Defered[int]: Number of current monthly active users
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment