Browse Source

Don't do failed checking on local requests

pull/2096/merge
Ruud 12 years ago
parent
commit
2715dbaaa5
  1. 6
      couchpotato/core/plugins/base.py

6
couchpotato/core/plugins/base.py

@ -2,7 +2,7 @@ from StringIO import StringIO
from couchpotato.core.event import fireEvent, addEvent from couchpotato.core.event import fireEvent, addEvent
from couchpotato.core.helpers.encoding import tryUrlencode, ss, toSafeString, \ from couchpotato.core.helpers.encoding import tryUrlencode, ss, toSafeString, \
toUnicode toUnicode
from couchpotato.core.helpers.variable import getExt, md5 from couchpotato.core.helpers.variable import getExt, md5, isLocalIP
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
from couchpotato.environment import Env from couchpotato.environment import Env
from multipartpost import MultipartPostHandler from multipartpost import MultipartPostHandler
@ -140,7 +140,7 @@ class Plugin(object):
if self.http_failed_disabled[host] > (time.time() - 900): if self.http_failed_disabled[host] > (time.time() - 900):
log.info2('Disabled calls to %s for 15 minutes because so many failed requests.', host) log.info2('Disabled calls to %s for 15 minutes because so many failed requests.', host)
if not show_error: if not show_error:
raise raise Exception('Disabled calls to %s for 15 minutes because so many failed requests')
else: else:
return '' return ''
else: else:
@ -203,7 +203,7 @@ class Plugin(object):
self.http_failed_request[host] += 1 self.http_failed_request[host] += 1
# Disable temporarily # Disable temporarily
if self.http_failed_request[host] > 5: if self.http_failed_request[host] > 5 and not isLocalIP(host):
self.http_failed_disabled[host] = time.time() self.http_failed_disabled[host] = time.time()
except: except:

Loading…
Cancel
Save