I have a Pagure deployment that had disk outage during night. The worker was trying to create new projects, but due to the disk outage, the task always failed. The problem was that it failed only after it created the session and due to the way tasks are implemented now, it didn't close the session. When the storage came back up, the worker couldn't recover, because the session pool was exhausted and no new sessions could be created.
This PR generally fixes situations when a task raises in the middle and doesn't do session cleanup.
I'm running tests with this change applied right now. I'll update this issue once I'm sure this didn't break anything.
I have a Pagure deployment that had disk outage during night. The worker was trying to create new projects, but due to the disk outage, the task always failed. The problem was that it failed only after it created the session and due to the way tasks are implemented now, it didn't close the session. When the storage came back up, the worker couldn't recover, because the session pool was exhausted and no new sessions could be created.
This PR generally fixes situations when a task raises in the middle and doesn't do session cleanup.
I'm running tests with this change applied right now. I'll update this issue once I'm sure this didn't break anything.