Better provider isAvailable check
This commit is contained in:
1 parent
4f0006db9f
commit
c340e6f125
1 file changed
+6
-6
@@ -27,14 +27,14 @@ class Provider(Plugin):
|
|||||||
if self.last_available_check.get(host) < now - 900:
|
if self.last_available_check.get(host) < now - 900:
|
||||||
self.last_available_check[host] = now
|
self.last_available_check[host] = now
|
||||||
|
|
||||||
data = self.urlopen(test_url, 30)
|
try:
|
||||||
if not data:
|
self.urlopen(test_url, 30)
|
||||||
log.error('%s unavailable, trying again in an 15 minutes.' % self.name)
|
|
||||||
self.is_available[host] = False
|
|
||||||
else:
|
|
||||||
self.is_available[host] = True
|
self.is_available[host] = True
|
||||||
|
except:
|
||||||
|
log.error('"%s" unavailable, trying again in an 15 minutes.' % host)
|
||||||
|
self.is_available[host] = False
|
||||||
|
|
||||||
return self.is_available[host]
|
return self.is_available.get(host, False)
|
||||||
|
|
||||||
|
|
||||||
class YarrProvider(Provider):
|
class YarrProvider(Provider):
|
||||||
|
|||||||
Reference in new issue
Block a user