From bea2db8464cacb42bfe168c8f0918f8de30fd2db Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Sun, 28 Jul 2013 19:08:43 +0100 Subject: Show a coherent error on bulk change lock timeout Since it's possible that the user will try to get patches while the update script is running, ensure we show a sensible error if the script times out waiting for a lock. Signed-off-by: Paul Eggleton --- layerindex/views.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'layerindex/views.py') diff --git a/layerindex/views.py b/layerindex/views.py index f945044402..71524b3f3c 100644 --- a/layerindex/views.py +++ b/layerindex/views.py @@ -232,6 +232,10 @@ def bulk_change_patch_view(request, pk): return response return HttpResponse('No patch data generated', content_type='text/plain') except Exception as e: + output = getattr(e, 'output', None) + if output: + if 'timeout' in output: + return HttpResponse('Failed to generate patches: timed out waiting for lock. Please try again shortly.', content_type='text/plain') return HttpResponse('Failed to generate patches: %s' % e, content_type='text/plain') # FIXME better error handling -- cgit 1.2.3-korg