diff options
author | Andrew Godwin | 2022-11-05 22:49:25 -0600 |
---|---|---|
committer | Andrew Godwin | 2022-11-05 22:49:25 -0600 |
commit | a2404e01cdbeef2ba332e147a5f2f1ca0a0310d7 (patch) | |
tree | 9aa1ae2ffad20a7afe8eac8cbe99ab9a53dcc0ca /users/views | |
parent | 56de2362a01089c8a5ca3c6e1affcade00ffdfce (diff) | |
download | takahe-a2404e01cdbeef2ba332e147a5f2f1ca0a0310d7.tar.gz takahe-a2404e01cdbeef2ba332e147a5f2f1ca0a0310d7.tar.bz2 takahe-a2404e01cdbeef2ba332e147a5f2f1ca0a0310d7.zip |
Queuing system and lazy profile fetch
Diffstat (limited to 'users/views')
-rw-r--r-- | users/views/identity.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/users/views/identity.py b/users/views/identity.py index fff521b..456fead 100644 --- a/users/views/identity.py +++ b/users/views/identity.py @@ -10,6 +10,7 @@ from django.views.decorators.csrf import csrf_exempt from django.views.generic import FormView, TemplateView, View from core.forms import FormHelper +from miniq.models import Task from users.models import Identity from users.shortcuts import by_handle_or_404 @@ -19,8 +20,10 @@ class ViewIdentity(TemplateView): template_name = "identity/view.html" def get_context_data(self, handle): - identity = by_handle_or_404(self.request, handle, local=False) + identity = Identity.by_handle(handle=handle) statuses = identity.statuses.all()[:100] + if identity.data_age > settings.IDENTITY_MAX_AGE: + Task.submit("identity_fetch", identity.handle) return { "identity": identity, "statuses": statuses, |