Skip to content

Commit

Permalink
Attempt to fix loss of database connection in recorder background pro…
Browse files Browse the repository at this point in the history
…cess
  • Loading branch information
Bensge committed Jan 23, 2025
1 parent bf64528 commit f1d7f94
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions spybot/recorder/recorder.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import traceback
from threading import Thread

from ts3 import TS3Error
from ts3.response import TS3ParserError

from Spybot2 import settings
from django import db

from spybot.recorder.client import Client
from spybot.recorder.ts import TS

Expand Down Expand Up @@ -55,6 +55,10 @@ def main_loop(self):
(event_type, event) = self.ts.wait_for_event()
print(f"new Event of type {event_type}: {event}")

# fix for closed database connection
# https://stackoverflow.com/a/78573290
db.close_old_connections()

# parse and store in db
self.process_event(event_type, event)

Expand Down

0 comments on commit f1d7f94

Please sign in to comment.