diff --git a/sdbs_infra/dashboard/views.py b/sdbs_infra/dashboard/views.py index 2c2157f..f3eff8c 100644 --- a/sdbs_infra/dashboard/views.py +++ b/sdbs_infra/dashboard/views.py @@ -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: