mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Add proc to just reset database connections
This commit is contained in:
@@ -603,8 +603,15 @@ var/failed_old_db_connections = 0
|
|||||||
//CHOMPEdit End
|
//CHOMPEdit End
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
/*/proc/setup_database_connection() CHOMPEdit TGSQL
|
/*/proc/setup_database_connection() CHOMPEdit TGSQL
|
||||||
|
|
||||||
|
||||||| parent of 8662f320d9... Merge pull request #11399 from VOREStation/Arokha/dbreset
|
||||||
|
/proc/setup_database_connection()
|
||||||
|
|
||||||
|
=======
|
||||||
|
/proc/setup_database_connection()
|
||||||
|
>>>>>>> 8662f320d9... Merge pull request #11399 from VOREStation/Arokha/dbreset
|
||||||
if(failed_db_connections > FAILED_DB_CONNECTION_CUTOFF) //If it failed to establish a connection more than 5 times in a row, don't bother attempting to conenct anymore.
|
if(failed_db_connections > FAILED_DB_CONNECTION_CUTOFF) //If it failed to establish a connection more than 5 times in a row, don't bother attempting to conenct anymore.
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -680,6 +687,32 @@ var/failed_old_db_connections = 0
|
|||||||
proc/establish_old_db_connection()
|
proc/establish_old_db_connection()
|
||||||
return SSdbcore.Connect()
|
return SSdbcore.Connect()
|
||||||
|
|
||||||
|
// Cleans up DB connections and recreates them
|
||||||
|
/proc/reset_database_connections()
|
||||||
|
var/list/results = list("-- Resetting DB connections --")
|
||||||
|
failed_db_connections = 0
|
||||||
|
|
||||||
|
if(dbcon?.IsConnected())
|
||||||
|
dbcon.Disconnect()
|
||||||
|
results += "dbcon was connected and asked to disconnect"
|
||||||
|
else
|
||||||
|
results += "dbcon was not connected"
|
||||||
|
|
||||||
|
if(dbcon_old?.IsConnected())
|
||||||
|
results += "WARNING: dbcon_old is connected, not touching it, but is this intentional?"
|
||||||
|
|
||||||
|
if(!config.sql_enabled)
|
||||||
|
results += "stopping because config.sql_enabled = false"
|
||||||
|
else
|
||||||
|
. = setup_database_connection()
|
||||||
|
if(.)
|
||||||
|
results += "SUCCESS: set up a connection successfully with setup_database_connection()"
|
||||||
|
else
|
||||||
|
results += "FAIL: failed to connect to the database with setup_database_connection()"
|
||||||
|
|
||||||
|
results += "-- DB Reset End --"
|
||||||
|
to_world_log(results.Join("\n"))
|
||||||
|
|
||||||
// Things to do when a new z-level was just made.
|
// Things to do when a new z-level was just made.
|
||||||
/world/proc/max_z_changed()
|
/world/proc/max_z_changed()
|
||||||
if(!istype(GLOB.players_by_zlevel, /list))
|
if(!istype(GLOB.players_by_zlevel, /list))
|
||||||
|
|||||||
Reference in New Issue
Block a user