From 1024860b0e76866882d887a9b87d71550b49f703 Mon Sep 17 00:00:00 2001 From: Yixiao Lin Date: Thu, 4 Jun 2015 14:14:46 -0500 Subject: [PATCH] Truncate number of jobs by 10,000 --- apps/jobbrowser/src/jobbrowser/views.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/jobbrowser/src/jobbrowser/views.py b/apps/jobbrowser/src/jobbrowser/views.py index 5e2a6d4..7e5ae87 100644 --- a/apps/jobbrowser/src/jobbrowser/views.py +++ b/apps/jobbrowser/src/jobbrowser/views.py @@ -109,6 +109,10 @@ def jobs(request): if request.GET.get('format') == 'json': try: jobs = get_api(request.user, request.jt).get_jobs(user=request.user, username=user, state=state, text=text, retired=retired) + ## when there are too many jobs, truncate + ## When there are about 10,000 jobs, it takes about 30 second to load. + ## The page crashes when there are more than 1,000,000 total jobs. + jobs = jobs[:10000] except Exception, ex: ex_message = str(ex) if 'Connection refused' in ex_message or 'standby RM' in ex_message: -- 1.9.3 (Apple Git-50)