Skip to content

Commit 57587ab

Browse files
committed
fix: Stale connections after task processor errors
1 parent 85f30f5 commit 57587ab

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

api/task_processor/threads.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import logging
22
import time
3-
import traceback
43
from threading import Thread
54

5+
from django.db import close_old_connections
66
from django.utils import timezone
77

88
from task_processor.processor import run_recurring_tasks, run_tasks
@@ -42,8 +42,8 @@ def run_iteration(self) -> None:
4242
# TODO: is this also what is causing tasks to get stuck as locked? Can we unlock
4343
# tasks here?
4444

45-
logger.error("Received error retrieving tasks: %s.", e)
46-
logger.debug(traceback.format_exc())
45+
logger.error("Received error retrieving tasks: %s.", e, exc_info=e)
46+
close_old_connections()
4747

4848
def stop(self):
4949
self._stopped = True

0 commit comments

Comments
 (0)