Browse Source

Fixed issue where task resources were not freed in case of error during the task

master
Youen 11 months ago
parent
commit
914c5c43f9
  1. 12
      src/web_utils/task.py

12
src/web_utils/task.py

@ -143,11 +143,13 @@ class Task:
self.__thread.start()
def __run(self):
self.run()
print('Task ' + self.task_id + ' has finished')
self.__finished_at = datetime.now()
Task.__free_resources(self)
Task.__update_pending_tasks()
try:
self.run()
print('Task ' + self.task_id + ' has finished')
self.__finished_at = datetime.now()
finally:
Task.__free_resources(self)
Task.__update_pending_tasks()
@staticmethod
def get(task_id):

Loading…
Cancel
Save