Reduce timeouts and fix minor API refresh issue

This commit is contained in:
2010-11-29 12:01:59 +00:00
parent 0c3dccc2e8
commit 8a456a8868

View File

@@ -65,7 +65,7 @@ def eveapi_add(request):
task = import_apikey.delay(api_key=form.cleaned_data['api_key'], api_userid=form.cleaned_data['user_id'], user=request.user.id) task = import_apikey.delay(api_key=form.cleaned_data['api_key'], api_userid=form.cleaned_data['user_id'], user=request.user.id)
try: try:
acc = task.wait(5) task.wait(5)
except celery.exceptions.TimeoutError: except celery.exceptions.TimeoutError:
messages.add_message(request, messages.INFO, "The addition of your API key is still processing, please check back in a minute or so") messages.add_message(request, messages.INFO, "The addition of your API key is still processing, please check back in a minute or so")
pass pass
@@ -108,10 +108,10 @@ def eveapi_refresh(request, userid=0):
if request.is_ajax(): if request.is_ajax():
try: try:
acc = task.wait(60) acc = task.wait(30)
return HttpResponse(serializers.serialize('json', [acc]), mimetype='application/javascript') return HttpResponse(serializers.serialize('json', [acc]), mimetype='application/javascript')
except celery.exceptions.TimeoutError: except celery.exceptions.TimeoutError:
return HttpResponse(serializers.serialize('json', [None]), mimetype='application/javascript') return HttpResponse(serializers.serialize('json', []), mimetype='application/javascript')
else: else:
messages.add_message(request, messages.INFO,"Key %s has been queued to be refreshed from the API" % acc.api_user_id) messages.add_message(request, messages.INFO,"Key %s has been queued to be refreshed from the API" % acc.api_user_id)