async all at once
This commit is contained in:
parent
35f9136452
commit
1ec26a7003
1 changed files with 13 additions and 6 deletions
|
@ -22,13 +22,20 @@ class IndexView(TemplateView):
|
||||||
template_name = "index.html"
|
template_name = "index.html"
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'links': asyncio.run(self.process_links(list(Link.objects.all()))),
|
'vps_stats': self.vps_stats(),
|
||||||
'services': asyncio.run(self.process_services(list(Service.objects.all()))),
|
**asyncio.run(self.process_all(list(Link.objects.all()),
|
||||||
'machines': asyncio.run(self.process_machines(list(Machine.objects.all()))),
|
list(Service.objects.all()),
|
||||||
'feed_items': asyncio.run(self.process_feeds(list(Feed.objects.all()))),
|
list(Machine.objects.all()),
|
||||||
'vps_stats': self.vps_stats()
|
list(Feed.objects.all())))
|
||||||
|
}
|
||||||
|
|
||||||
|
async def process_all(self, links, services, machines, feeds):
|
||||||
|
return {
|
||||||
|
'links': await self.process_links(links),
|
||||||
|
'services': await self.process_services(services),
|
||||||
|
'machines': await self.process_machines(machines),
|
||||||
|
'feed_items': await self.process_feeds(feeds),
|
||||||
}
|
}
|
||||||
|
|
||||||
async def process_links(self, links):
|
async def process_links(self, links):
|
||||||
|
|
Loading…
Reference in a new issue