Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
56da835e
Commit
56da835e
authored
8 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Add necessary logging contexts
parent
96bcfb29
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/push/httppusher.py
+25
-24
25 additions, 24 deletions
synapse/push/httppusher.py
with
25 additions
and
24 deletions
synapse/push/httppusher.py
+
25
−
24
View file @
56da835e
...
...
@@ -21,6 +21,7 @@ import logging
import
push_rule_evaluator
import
push_tools
from
synapse.util.logcontext
import
LoggingContext
from
synapse.util.metrics
import
Measure
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -85,9 +86,8 @@ class HttpPusher(object):
@defer.inlineCallbacks
def
on_new_notifications
(
self
,
min_stream_ordering
,
max_stream_ordering
):
with
Measure
(
self
.
clock
,
"
push.on_new_notifications
"
):
self
.
max_stream_ordering
=
max
(
max_stream_ordering
,
self
.
max_stream_ordering
)
yield
self
.
_process
()
self
.
max_stream_ordering
=
max
(
max_stream_ordering
,
self
.
max_stream_ordering
)
yield
self
.
_process
()
@defer.inlineCallbacks
def
on_new_receipts
(
self
,
min_stream_id
,
max_stream_id
):
...
...
@@ -95,16 +95,16 @@ class HttpPusher(object):
# We could check the receipts are actually m.read receipts here,
# but currently that's the only type of receipt anyway...
with
Measure
(
self
.
clock
,
"
push.on_new_receipts
"
):
badge
=
yield
push_tools
.
get_badge_count
(
self
.
hs
.
get_datastore
(),
self
.
user_id
)
with
LoggingContext
(
"
push._process
"
):
with
Measure
(
self
.
clock
,
"
push.on_new_receipts
"
):
badge
=
yield
push_tools
.
get_badge_count
(
self
.
hs
.
get_datastore
(),
self
.
user_id
)
yield
self
.
send_badge
(
badge
)
@defer.inlineCallbacks
def
on_timer
(
self
):
with
Measure
(
self
.
clock
,
"
push.on_timer
"
):
yield
self
.
_process
()
yield
self
.
_process
()
def
on_stop
(
self
):
if
self
.
timed_call
:
...
...
@@ -115,21 +115,22 @@ class HttpPusher(object):
if
self
.
processing
:
return
with
Measure
(
self
.
clock
,
"
push._process
"
):
try
:
self
.
processing
=
True
# if the max ordering changes while we're running _unsafe_process,
# call it again, and so on until we've caught up.
while
True
:
starting_max_ordering
=
self
.
max_stream_ordering
try
:
yield
self
.
_unsafe_process
()
except
:
logger
.
exception
(
"
Exception processing notifs
"
)
if
self
.
max_stream_ordering
==
starting_max_ordering
:
break
finally
:
self
.
processing
=
False
with
LoggingContext
(
"
push._process
"
):
with
Measure
(
self
.
clock
,
"
push._process
"
):
try
:
self
.
processing
=
True
# if the max ordering changes while we're running _unsafe_process,
# call it again, and so on until we've caught up.
while
True
:
starting_max_ordering
=
self
.
max_stream_ordering
try
:
yield
self
.
_unsafe_process
()
except
:
logger
.
exception
(
"
Exception processing notifs
"
)
if
self
.
max_stream_ordering
==
starting_max_ordering
:
break
finally
:
self
.
processing
=
False
@defer.inlineCallbacks
def
_unsafe_process
(
self
):
...
...
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