Browse Source

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

master
Youen 10 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() self.__thread.start()
def __run(self): def __run(self):
self.run() try:
print('Task ' + self.task_id + ' has finished') self.run()
self.__finished_at = datetime.now() print('Task ' + self.task_id + ' has finished')
Task.__free_resources(self) self.__finished_at = datetime.now()
Task.__update_pending_tasks() finally:
Task.__free_resources(self)
Task.__update_pending_tasks()
@staticmethod @staticmethod
def get(task_id): def get(task_id):

Loading…
Cancel
Save