diff --git a/lib/galaxy/jobs/handler.py b/lib/galaxy/jobs/handler.py index 008a4eee0be4..1df3503ffb96 100644 --- a/lib/galaxy/jobs/handler.py +++ b/lib/galaxy/jobs/handler.py @@ -395,6 +395,8 @@ def __monitor_step(self): self.__handle_waiting_jobs() except StopSignalException: pass + finally: + self.sa_session.remove() log.trace(monitor_step_timer.to_str()) def __handle_waiting_jobs(self): @@ -583,9 +585,6 @@ def __handle_waiting_jobs(self): with transaction(self.sa_session): self.sa_session.commit() - # Done with the session - self.sa_session.remove() - def __filter_jobs_with_invalid_input_states(self, jobs): """ Takes list of jobs and filters out jobs whose input datasets are in invalid state and