mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
fix: close stale DB connections before first query
This commit is contained in:
parent
3761a7cb21
commit
519b568ccb
1 changed files with 5 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ import traceback
|
|||
|
||||
import django
|
||||
from django.conf import settings
|
||||
import django.db
|
||||
from django.db import connection
|
||||
from django.db.utils import OperationalError
|
||||
from django.utils.translation import gettext as _
|
||||
|
|
@ -187,6 +188,10 @@ class EvenniaServerService(MultiService):
|
|||
|
||||
# clear server startup mode
|
||||
try:
|
||||
# Close stale DB connections inherited from the pre-fork parent
|
||||
# process. Python 3.14's sqlite3 module is not fork-safe and will
|
||||
# raise MemoryError if a pre-fork connection is reused.
|
||||
django.db.connections.close_all()
|
||||
evennia.ServerConfig.objects.conf("server_starting_mode", delete=True)
|
||||
except OperationalError:
|
||||
print("Server server_starting_mode couldn't unset - db not set up.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue