Don't do failed checking on local requests
This commit is contained in:
1 parent
3baf12d3e4
commit
2715dbaaa5
1 file changed
+3
-3
@@ -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:
|
||||||
|
|||||||
Reference in new issue
Block a user