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"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
|
||||
return {
|
||||
'links': asyncio.run(self.process_links(list(Link.objects.all()))),
|
||||
'services': asyncio.run(self.process_services(list(Service.objects.all()))),
|
||||
'machines': asyncio.run(self.process_machines(list(Machine.objects.all()))),
|
||||
'feed_items': asyncio.run(self.process_feeds(list(Feed.objects.all()))),
|
||||
'vps_stats': self.vps_stats()
|
||||
'vps_stats': self.vps_stats(),
|
||||
**asyncio.run(self.process_all(list(Link.objects.all()),
|
||||
list(Service.objects.all()),
|
||||
list(Machine.objects.all()),
|
||||
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):
|
||||
|
|
Loading…
Reference in a new issue