This is an automated email from the ASF dual-hosted git repository.
yasithdev pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airavata-portals.git
The following commit(s) were added to refs/heads/main by this push:
new e49c9214e fix(portal): de-Thrift the notifications context processor
(Track D) (#181)
e49c9214e is described below
commit e49c9214e4838d9eb27deb038a71644330d933dd
Author: Yasith Jayawardana <[email protected]>
AuthorDate: Mon Jun 8 21:57:58 2026 -0400
fix(portal): de-Thrift the notifications context processor (Track D) (#181)
The `get_notifications` template context processor ran a Thrift
`getAllNotifications` on every authenticated HTML page render. With the
legacy
Thrift server gone, that call blocked for the full socket read-timeout
(~25s),
so every server-rendered page (dashboard, projects, experiments, ...) hung.
Repoint it to the gRPC research facade (`get_all_notifications`) and adapt
each
protobuf `Notification` with the existing `grpc_adapters.notification` (the
same
adapter the migrated `ManageNotificationViewSet` uses), so the JSON payload
handed to the frontend is unchanged.
Verified live: `/workspace/dashboard` went from a 25s hang to 200 in ~0.02s;
`/workspace/projects` renders 200.
---
airavata-django-portal/django_airavata/context_processors.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/airavata-django-portal/django_airavata/context_processors.py
b/airavata-django-portal/django_airavata/context_processors.py
index 43cbfcf95..c430dc397 100644
--- a/airavata-django-portal/django_airavata/context_processors.py
+++ b/airavata-django-portal/django_airavata/context_processors.py
@@ -10,17 +10,21 @@ from django.core.exceptions import ObjectDoesNotExist
from django.urls import reverse
from django_airavata.app_config import AiravataAppConfig
+from django_airavata.apps.api import grpc_adapters
from django_airavata.apps.api.models import User_Notifications
logger = logging.getLogger(__name__)
def get_notifications(request):
- if request.user.is_authenticated and hasattr(request, 'airavata_client'):
+ if request.user.is_authenticated and getattr(request, 'authz_token', None):
unread_notifications = 0
try:
- notifications = request.airavata_client.getAllNotifications(
- request.authz_token, settings.GATEWAY_ID)
+ notifications = [
+ grpc_adapters.notification(n)
+ for n in request.airavata.research.get_all_notifications(
+ settings.GATEWAY_ID)
+ ]
except Exception:
logger.warning("Failed to load notifications")
notifications = []