We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f260bb3 commit d2b1bf3Copy full SHA for d2b1bf3
tcf_website/api/views.py
@@ -2,6 +2,7 @@
2
"""DRF Viewsets"""
3
import asyncio
4
from threading import Thread
5
+from django.db import connection
6
from django.db.models import Avg, Sum
7
from django.http import JsonResponse
8
from rest_framework import viewsets
@@ -195,6 +196,8 @@ def _run_update():
195
196
asyncio.run(update_enrollment_data(pk))
197
except (asyncio.TimeoutError, requests.RequestException, ValueError) as exc:
198
print(f"Enrollment update failed for course {pk}: {exc}")
199
+ finally:
200
+ connection.close()
201
202
thread = Thread(target=_run_update, daemon=True)
203
thread.start()
0 commit comments