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
Container Registry
Model registry
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
Maunium
synapse
Commits
ed008e85
"README.md" did not exist on "ce54477f6fa0264ef00b15bc3e0c2503d85ab061"
Commit
ed008e85
authored
10 years ago
by
Paul "LeoNerd" Evans
Browse files
Options
Downloads
Patches
Plain Diff
Reduce activity timer granularity to avoid too many quick updates (SYN-247)
parent
72d84064
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/handlers/presence.py
+8
-0
8 additions, 0 deletions
synapse/handlers/presence.py
with
8 additions
and
0 deletions
synapse/handlers/presence.py
+
8
−
0
View file @
ed008e85
...
...
@@ -33,6 +33,10 @@ logger = logging.getLogger(__name__)
metrics
=
synapse
.
metrics
.
get_metrics_for
(
__name__
)
# Don't bother bumping "last active" time if it differs by less than 60 seconds
LAST_ACTIVE_GRANULARITY
=
60
*
1000
# TODO(paul): Maybe there's one of these I can steal from somewhere
def
partition
(
l
,
func
):
"""
Partition the list by the result of func applied to each element.
"""
...
...
@@ -282,6 +286,10 @@ class PresenceHandler(BaseHandler):
if
now
is
None
:
now
=
self
.
clock
.
time_msec
()
prev_state
=
self
.
_get_or_make_usercache
(
user
)
if
now
-
prev_state
.
state
.
get
(
"
last_active
"
,
0
)
<
LAST_ACTIVE_GRANULARITY
:
return
self
.
changed_presencelike_data
(
user
,
{
"
last_active
"
:
now
})
def
changed_presencelike_data
(
self
,
user
,
state
):
...
...
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