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

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

Issue 2014063002: Run format-webkit on webkitpy code (without string conversion). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 6 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 self._grown_factor = grown_factor 46 self._grown_factor = grown_factor
47 self._timeout_seconds = timeout_seconds 47 self._timeout_seconds = timeout_seconds
48 self._convert_404_to_None = convert_404_to_None 48 self._convert_404_to_None = convert_404_to_None
49 49
50 def run(self, request): 50 def run(self, request):
51 self._total_sleep = 0 51 self._total_sleep = 0
52 self._backoff_seconds = self._initial_backoff_seconds 52 self._backoff_seconds = self._initial_backoff_seconds
53 while True: 53 while True:
54 try: 54 try:
55 return request() 55 return request()
56 except urllib2.HTTPError, e: 56 except urllib2.HTTPError as e:
57 if self._convert_404_to_None and e.code == 404: 57 if self._convert_404_to_None and e.code == 404:
58 return None 58 return None
59 self._check_for_timeout() 59 self._check_for_timeout()
60 _log.warn("Received HTTP status %s loading \"%s\". Retrying in %s seconds..." % 60 _log.warn("Received HTTP status %s loading \"%s\". Retrying in %s seconds..." %
61 (e.code, e.filename, self._backoff_seconds)) 61 (e.code, e.filename, self._backoff_seconds))
62 self._sleep() 62 self._sleep()
63 63
64 def _check_for_timeout(self): 64 def _check_for_timeout(self):
65 if self._total_sleep + self._backoff_seconds > self._timeout_seconds: 65 if self._total_sleep + self._backoff_seconds > self._timeout_seconds:
66 raise NetworkTimeout() 66 raise NetworkTimeout()
67 67
68 def _sleep(self): 68 def _sleep(self):
69 time.sleep(self._backoff_seconds) 69 time.sleep(self._backoff_seconds)
70 self._total_sleep += self._backoff_seconds 70 self._total_sleep += self._backoff_seconds
71 self._backoff_seconds *= self._grown_factor 71 self._backoff_seconds *= self._grown_factor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698