diff --git a/web/pgadmin/misc/bgprocess/processes.py b/web/pgadmin/misc/bgprocess/processes.py index f3bab2616..32aa96767 100644 --- a/web/pgadmin/misc/bgprocess/processes.py +++ b/web/pgadmin/misc/bgprocess/processes.py @@ -209,9 +209,17 @@ class BatchProcess(object): ) self.ecode = p.poll() - if self.ecode is not None: - # TODO:: Couldn't start execution - pass + if self.ecode is not None and self.ecode != 0: + # TODO:// Find a way to read error from detached failed process + + # Couldn't start execution + p = Process.query.filter_by( + pid=self.id, user_id=current_user.id + ).first() + p.start_time = p.end_time = get_current_time() + if not p.exit_code: + p.exit_code = self.ecode + db.session.commit() def status(self, out=0, err=0): import codecs diff --git a/web/pgadmin/misc/bgprocess/static/js/bgprocess.js b/web/pgadmin/misc/bgprocess/static/js/bgprocess.js index cdc80f1e7..122a30652 100644 --- a/web/pgadmin/misc/bgprocess/static/js/bgprocess.js +++ b/web/pgadmin/misc/bgprocess/static/js/bgprocess.js @@ -220,8 +220,9 @@ function(_, S, $, pgBrowser, alertify, pgMessages) { setTimeout(function() { self.update(res); }, 10); }, error: function(res) { - // Try after some time - setTimeout(function() { self.update(res); }, 10000); + // Try after some time only if job id present + if (res.status != 410) + setTimeout(function() { self.update(res); }, 10000); } }); },