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

Commit

Permalink
Merge pull request #4716 from matrix-org/erikj/pusher_logging
Browse files Browse the repository at this point in the history
Fix up pusher logging a bit
  • Loading branch information
erikjohnston authored Feb 22, 2019
2 parents 9982c71 + b82c9cf commit d14e94b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/4716.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Reduce pusher logging on startup
5 changes: 5 additions & 0 deletions synapse/push/httppusher.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ def __init__(self, hs, pusherdict):
pusherdict['pushkey'],
)

if self.data is None:
raise PusherConfigException(
"data can not be null for HTTP pusher"
)

if 'url' not in self.data:
raise PusherConfigException(
"'url' required in data for HTTP pusher"
Expand Down
2 changes: 1 addition & 1 deletion synapse/push/pusher.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def create_pusher(self, pusherdict):
f = self.pusher_types.get(kind, None)
if not f:
return None
logger.info("creating %s pusher for %r", kind, pusherdict)
logger.debug("creating %s pusher for %r", kind, pusherdict)
return f(self.hs, pusherdict)

def _create_email_pusher(self, _hs, pusherdict):
Expand Down
10 changes: 10 additions & 0 deletions synapse/push/pusherpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from twisted.internet import defer

from synapse.metrics.background_process_metrics import run_as_background_process
from synapse.push import PusherConfigException
from synapse.push.pusher import PusherFactory

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -222,6 +223,15 @@ def _start_pusher(self, pusherdict):
"""
try:
p = self.pusher_factory.create_pusher(pusherdict)
except PusherConfigException as e:
logger.warning(
"Pusher incorrectly configured user=%s, appid=%s, pushkey=%s: %s",
pusherdict.get('user_name'),
pusherdict.get('app_id'),
pusherdict.get('pushkey'),
e,
)
return
except Exception:
logger.exception("Couldn't start a pusher: caught Exception")
return
Expand Down

0 comments on commit d14e94b

Please sign in to comment.