Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/net/networktransaction.py

Issue 2188623002: Change logging statements to not use the "%" operator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 def run(self, request): 52 def run(self, request):
53 self._total_sleep = 0 53 self._total_sleep = 0
54 self._backoff_seconds = self._initial_backoff_seconds 54 self._backoff_seconds = self._initial_backoff_seconds
55 while True: 55 while True:
56 try: 56 try:
57 return request() 57 return request()
58 except urllib2.HTTPError as e: 58 except urllib2.HTTPError as e:
59 if self._convert_404_to_None and e.code == 404: 59 if self._convert_404_to_None and e.code == 404:
60 return None 60 return None
61 self._check_for_timeout() 61 self._check_for_timeout()
62 _log.warn("Received HTTP status %s loading \"%s\". Retrying in %s seconds..." % 62 _log.warning("Received HTTP status %s loading \"%s\". Retrying in %s seconds...",
63 (e.code, e.filename, self._backoff_seconds)) 63 e.code, e.filename, self._backoff_seconds)
64 self._sleep() 64 self._sleep()
65 65
66 def _check_for_timeout(self): 66 def _check_for_timeout(self):
67 if self._total_sleep + self._backoff_seconds > self._timeout_seconds: 67 if self._total_sleep + self._backoff_seconds > self._timeout_seconds:
68 raise NetworkTimeout() 68 raise NetworkTimeout()
69 69
70 def _sleep(self): 70 def _sleep(self):
71 time.sleep(self._backoff_seconds) 71 time.sleep(self._backoff_seconds)
72 self._total_sleep += self._backoff_seconds 72 self._total_sleep += self._backoff_seconds
73 self._backoff_seconds *= self._grown_factor 73 self._backoff_seconds *= self._grown_factor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698