Code style fixes.

This commit is contained in:
Mark Haines 2015-01-29 16:10:35 +00:00
parent 8b1dd9f57f
commit acb68a39e0
8 changed files with 42 additions and 26 deletions

View file

@ -189,8 +189,8 @@ class Pusher(object):
# for sanity, we only remove the pushkey if it
# was the one we actually sent...
logger.warn(
("Ignoring rejected pushkey %s because we "
"didn't send it"), pk
("Ignoring rejected pushkey %s because we"
" didn't send it"), pk
)
else:
logger.info(
@ -236,8 +236,7 @@ class Pusher(object):
# of old notifications.
logger.warn("Giving up on a notification to user %s, "
"pushkey %s",
self.user_name, self.pushkey
)
self.user_name, self.pushkey)
self.backoff_delay = Pusher.INITIAL_BACKOFF
self.last_token = chunk['end']
self.store.update_pusher_last_token(
@ -258,8 +257,7 @@ class Pusher(object):
"Trying again in %dms",
self.user_name,
self.clock.time_msec() - self.failing_since,
self.backoff_delay
)
self.backoff_delay)
yield synapse.util.async.sleep(self.backoff_delay / 1000.0)
self.backoff_delay *= 2
if self.backoff_delay > Pusher.MAX_BACKOFF:
@ -299,7 +297,6 @@ class Pusher(object):
self.has_unread = False
def _value_for_dotted_key(dotted_key, event):
parts = dotted_key.split(".")
val = event
@ -310,6 +307,7 @@ def _value_for_dotted_key(dotted_key, event):
parts = parts[1:]
return val
def _tweaks_for_actions(actions):
tweaks = {}
for a in actions:
@ -319,6 +317,7 @@ def _tweaks_for_actions(actions):
tweaks['sound'] = a['set_sound']
return tweaks
class PusherConfigException(Exception):
def __init__(self, msg):
super(PusherConfigException, self).__init__(msg)
super(PusherConfigException, self).__init__(msg)

View file

@ -71,11 +71,11 @@ class HttpPusher(Pusher):
# we may have to fetch this over federation and we
# can't trust it anyway: is it worth it?
#'from_display_name': 'Steve Stevington'
'counts': { #-- we don't mark messages as read yet so
# we have no way of knowing
'counts': { # -- we don't mark messages as read yet so
# we have no way of knowing
# Just set the badge to 1 until we have read receipts
'unread': 1,
# 'missed_calls': 2
# 'missed_calls': 2
},
'devices': [
{
@ -142,4 +142,4 @@ class HttpPusher(Pusher):
rejected = []
if 'rejected' in resp:
rejected = resp['rejected']
defer.returnValue(rejected)
defer.returnValue(rejected)

View file

@ -149,4 +149,4 @@ class PusherPool:
logger.info("Stopping pusher %s", fullid)
self.pushers[fullid].stop()
del self.pushers[fullid]
yield self.store.delete_pusher_by_app_id_pushkey(app_id, pushkey)
yield self.store.delete_pusher_by_app_id_pushkey(app_id, pushkey)