##// END OF EJS Templates
celery: improve fetching of repo_check tasks....
marcink -
r2387:e641eb6b default
parent child Browse files
Show More
@@ -78,11 +78,15 b' class RepoChecksView(BaseAppView):'
78 78
79 79 if task_id and task_id not in ['None']:
80 80 import rhodecode
81 from rhodecode.lib.celerylib.loader import celery_app
81 from rhodecode.lib.celerylib.loader import celery_app, exceptions
82 82 if rhodecode.CELERY_ENABLED:
83 log.debug('celery: checking result for task:%s', task_id)
83 84 task = celery_app.AsyncResult(task_id)
84 task.get()
85 if task.failed():
85 try:
86 task.get(timeout=10)
87 except exceptions.TimeoutError:
88 task = None
89 if task and task.failed():
86 90 msg = self._log_creation_exception(task.result, repo_name)
87 91 h.flash(msg, category='error')
88 92 raise HTTPFound(h.route_path('home'), code=501)
@@ -28,6 +28,7 b' import logging'
28 28 from celery import Celery
29 29 from celery import signals
30 30 from celery import Task
31 from celery import exceptions # noqa
31 32 from kombu.serialization import register
32 33 from pyramid.threadlocal import get_current_request
33 34
@@ -41,8 +41,9 b''
41 41 var url = "${h.route_path('repo_creating_check', repo_name=c.repo_name, _query=dict(task_id=c.task_id))}";
42 42 $.ajax({
43 43 url: url,
44 timeout: 60*1000, // sets timeout to 60 seconds
44 45 complete: function(resp) {
45 if (resp.status == 200) {
46 if (resp.status === 200) {
46 47 var jsonResponse = resp.responseJSON;
47 48
48 49 if (jsonResponse === undefined) {
@@ -61,9 +62,10 b''
61 62 }
62 63 }
63 64 else {
65 var message = _gettext('Fetching repository state failed. Error code: {0} {1}. Try <a href="{2}">refreshing</a> this page.').format(resp.status, resp.statusText, url);
64 66 var payload = {
65 67 message: {
66 message: _gettext('Fetching repository state failed. Error code: {0} {1}. Try refreshing this page.').format(resp.status, resp.statusText),
68 message: message,
67 69 level: 'error',
68 70 force: true
69 71 }
General Comments 0
You need to be logged in to leave comments. Login now