From 1c611b9cff99fd6f5be336d9e735e43c93a4424e Mon Sep 17 00:00:00 2001 From: alexkar598 <25136265+alexkar598@users.noreply.github.com> Date: Sat, 26 Jun 2021 07:12:06 -0400 Subject: [PATCH] Ports #59750 from TG: Adds configs to disable hard deletes (#11622) * Adds configs to disable hard deletes * Apply suggestions from code review Co-authored-by: Jordan Brown * Apply suggestions from code review Co-authored-by: MrStonedOne Co-authored-by: Jordan Brown Co-authored-by: Jamie D <993128+JamieD1@users.noreply.github.com> --- code/controllers/configuration/entries/general.dm | 6 +++++- code/controllers/subsystem/garbage.dm | 7 ++++--- config/config.txt | 6 ++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index 49e0c6b6e98b..8d8cdf3413b6 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -499,4 +499,8 @@ /datum/config_entry/string/centcom_ban_db // URL for the CentCom Galactic Ban DB API -/datum/config_entry/flag/auto_profile \ No newline at end of file +/datum/config_entry/flag/auto_profile + +/datum/config_entry/flag/disable_gc_failure_hard_deletes + +/datum/config_entry/flag/disable_all_hard_deletes diff --git a/code/controllers/subsystem/garbage.dm b/code/controllers/subsystem/garbage.dm index e0c9af56a0a9..e635b71a9734 100644 --- a/code/controllers/subsystem/garbage.dm +++ b/code/controllers/subsystem/garbage.dm @@ -162,7 +162,8 @@ SUBSYSTEM_DEF(garbage) testing("GC: -- \ref[src] | [type] was unable to be GC'd --") I.failures++ if (GC_QUEUE_HARDDELETE) - HardDelete(D) + if (!CONFIG_GET(flag/disable_gc_failure_hard_deletes)) + HardDelete(D) if (MC_TICK_CHECK) return continue @@ -200,8 +201,8 @@ SUBSYSTEM_DEF(garbage) ++totaldels var/type = D.type var/refID = "\ref[D]" - - del(D) + if (!CONFIG_GET(flag/disable_all_hard_deletes)) + del(D) tick = (TICK_USAGE-tick+((world.time-ticktime)/world.tick_lag*100)) diff --git a/config/config.txt b/config/config.txt index 10d91cb1c408..355f05c87287 100644 --- a/config/config.txt +++ b/config/config.txt @@ -436,3 +436,9 @@ DEFAULT_VIEW_SQUARE 15x15 CENTCOM_BAN_DB https://centcom.melonmesa.com/ban/search AUTO_PROFILE + +## Uncomment to disable hard deleting garbage collection failures. (Hard deleting GC failures causes lag in order to bring memory usage down and keep bugged objects from hanging around and causing bugs in other things.) You can safely enable this for performance on production if the lag spikes are too disruptive) +#DISABLE_GC_FAILURE_HARD_DELETES + +## Uncomment to disable hard deletes entirely, even things that explicitly request. This is not recommended unless you have a need for it during events or other high pop times where performance is key. +#DISABLE_ALL_HARD_DELETES