[MIRROR] Moving the database to a subsystem (#9963)

Co-authored-by: Selis <12716288+ItsSelis@users.noreply.github.com>
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-01-29 03:25:00 -07:00
committed by GitHub
parent 26ff936832
commit 40e935a774
33 changed files with 559 additions and 310 deletions

View File

@@ -497,7 +497,6 @@ Ignore_errors instructes mysql to continue inserting rows if some of them have e
return ..()
/datum/db_query/CanProcCall(proc_name)
//fuck off kevinz
return FALSE
/datum/db_query/proc/Activity(activity)
@@ -579,7 +578,6 @@ Ignore_errors instructes mysql to continue inserting rows if some of them have e
status = DB_QUERY_BROKEN
return
/datum/db_query/proc/slow_query_check()
message_admins("HEY! A database query timed out. Did the server just hang? <a href='byond://?_src_=holder;[HrefToken()];slowquery=yes'>\[YES\]</a>|<a href='byond://?_src_=holder;[HrefToken()];slowquery=no'>\[NO\]</a>")

View File

@@ -10,7 +10,7 @@ SUBSYSTEM_DEF(persist)
flags = SS_BACKGROUND|SS_NO_INIT|SS_KEEP_TIMING
runlevels = RUNLEVEL_GAME|RUNLEVEL_POSTGAME
var/list/currentrun = list()
var/list/query_stack = list() //CHOMPAdd TGSQL
var/list/query_stack = list()
/datum/controller/subsystem/persist/fire(var/resumed = FALSE)
update_department_hours(resumed)
@@ -21,7 +21,7 @@ SUBSYSTEM_DEF(persist)
return
establish_db_connection()
if(!SSdbcore.IsConnected()) //CHOMPEdit TGSQL
if(!SSdbcore.IsConnected())
src.currentrun.Cut()
return
if(!resumed)
@@ -30,7 +30,7 @@ SUBSYSTEM_DEF(persist)
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
var/list/query_stack = src.query_stack //CHOMPAdd TGSQL
var/list/query_stack = src.query_stack
while (currentrun.len)
var/mob/M = currentrun[currentrun.len]
currentrun.len--
@@ -92,15 +92,15 @@ SUBSYSTEM_DEF(persist)
"department" = sql_dpt,
"hours" = sql_bal,
"total_hours" = sql_total
)
query_stack += list(entry) //CHOMPEdit TGSQL
)
query_stack += list(entry)
if (MC_TICK_CHECK)
return
//CHOMPAdd Start TGSQL
if(query_stack.len)
SSdbcore.MassInsert(format_table_name("vr_player_hours"), query_stack, duplicate_key = "ON DUPLICATE KEY UPDATE hours = VALUES(hours), total_hours = VALUES(total_hours)")
query_stack.Cut()
//CHOMPAdd End TGSQL
// This proc tries to find the job datum of an arbitrary mob.
/datum/controller/subsystem/persist/proc/detect_job(var/mob/M)

View File

@@ -31,7 +31,7 @@ SUBSYSTEM_DEF(statpanels)
"Map: [using_map.name]",
//cached ? "Next Map: [cached.map_name]" : null,
//"Next Map: -- Not Available --",
"Round ID: [GLOB.round_id ? GLOB.round_id : "NULL"]", // CHOMPEdit
"Round ID: [GLOB.round_id ? GLOB.round_id : "NULL"]",
"Server Time: [time2text(world.timeofday, "YYYY-MM-DD hh:mm:ss")]",
"Round Time: [roundduration2text()]",
"Station Date: [stationdate2text()], [capitalize(GLOB.world_time_season)]", // CHOMPEdit

View File

@@ -546,7 +546,7 @@ var/global/datum/controller/subsystem/ticker/ticker
for(var/i in total_antagonists)
log_game("[i]s[total_antagonists[i]].")
SSdbcore.SetRoundEnd() // CHOMPEdit
SSdbcore.SetRoundEnd()
return 1