lower service timeout to 2, put both in a class constant
This commit is contained in:
parent
d65e92e323
commit
054b18b593
1 changed files with 7 additions and 4 deletions
|
@ -23,6 +23,9 @@ logger = logging.getLogger(__name__)
|
|||
class IndexView(TemplateView):
|
||||
template_name = "index.html"
|
||||
|
||||
SERVICE_TIMEOUT = 2
|
||||
REQ_TIMEOUT = 5
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
return {
|
||||
'vps_stats': self.vps_stats(),
|
||||
|
@ -47,7 +50,7 @@ class IndexView(TemplateView):
|
|||
async def process_links(self, links):
|
||||
result = []
|
||||
|
||||
session = aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=5, sock_connect=1))
|
||||
session = aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=self.REQ_TIMEOUT, sock_connect=1))
|
||||
|
||||
for link in links:
|
||||
index_text = None
|
||||
|
@ -71,7 +74,7 @@ class IndexView(TemplateView):
|
|||
async def process_services(self, services):
|
||||
result = []
|
||||
|
||||
session = aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=3, sock_connect=1))
|
||||
session = aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=self.SERVICE_TIMEOUT, sock_connect=1))
|
||||
|
||||
for service in services:
|
||||
index_status, index_text = None, None
|
||||
|
@ -109,7 +112,7 @@ class IndexView(TemplateView):
|
|||
async def process_machines(self, machines):
|
||||
result = []
|
||||
|
||||
session = aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=5, sock_connect=1), headers={
|
||||
session = aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=self.REQ_TIMEOUT, sock_connect=1), headers={
|
||||
'X-Api-Key': settings.HEALTCHECKS_API_KEY
|
||||
})
|
||||
|
||||
|
@ -141,7 +144,7 @@ class IndexView(TemplateView):
|
|||
async def process_feeds(self, feeds):
|
||||
result = []
|
||||
|
||||
session = aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=5, sock_connect=1))
|
||||
session = aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=self.REQ_TIMEOUT, sock_connect=1))
|
||||
|
||||
for feed in feeds:
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue