From ea0fa2fc85128255dbfbf98dc55bbe65e7bc3a3b Mon Sep 17 00:00:00 2001 From: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com> Date: Fri, 22 Jan 2021 14:25:28 +0000 Subject: [PATCH] Fixes slow roundstarts (#15326) * More roundstart optimisations * Mochi tweaks --- code/game/gamemodes/game_mode.dm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 83afb1bbc42..d61b59cace2 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -73,13 +73,7 @@ spawn (ROUNDSTART_LOGOUT_REPORT_TIME) display_roundstart_logout_report() - if(SSticker && SSticker.mode && SSdbcore.IsConnected()) - var/datum/db_query/query_round_game_mode = SSdbcore.NewQuery("UPDATE [format_table_name("round")] SET game_mode=:gm WHERE id=:rid", list( - "gm" = SSticker.mode, - "rid" = GLOB.round_id - )) - if(query_round_game_mode.warn_execute()) - qdel(query_round_game_mode) + INVOKE_ASYNC(src, .proc/set_mode_in_db) // Async query, dont bother slowing roundstart generate_station_goals() GLOB.start_state = new /datum/station_state() @@ -91,6 +85,17 @@ /datum/game_mode/process() return 0 +// I wonder what this could do guessing by the name +/datum/game_mode/proc/set_mode_in_db() + if(SSticker?.mode && SSdbcore.IsConnected()) + var/datum/db_query/query_round_game_mode = SSdbcore.NewQuery("UPDATE [format_table_name("round")] SET game_mode=:gm WHERE id=:rid", list( + "gm" = SSticker.mode.name, + "rid" = GLOB.round_id + )) + // We dont do anything with output. Dont bother wrapping with if() + query_round_game_mode.warn_execute() + qdel(query_round_game_mode) + //Called by the gameticker /datum/game_mode/proc/process_job_tasks() var/obj/machinery/message_server/useMS = null