From 9ddfd4a289bc816ad6eb6e7a44b5f041b07f813e Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Tue, 13 Feb 2024 09:09:12 -0800 Subject: [PATCH] Moves inter-round caches to cache/. Deletes tmp/ between rounds. Keeps tts from killing servers. (#81433) --- .gitignore | 1 + code/controllers/subsystem/server_maint.dm | 5 +++++ code/modules/asset_cache/asset_list.dm | 2 +- config/config.txt | 4 ++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index f5801d891f966..0e467b18cf765 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ #Ignore everything in datafolder and subdirectories /data/**/* /tmp/**/* +/cache/**/* #Ignore byond config folder. /cfg/**/* diff --git a/code/controllers/subsystem/server_maint.dm b/code/controllers/subsystem/server_maint.dm index 69a5edcca3a63..f011d01ca679d 100644 --- a/code/controllers/subsystem/server_maint.dm +++ b/code/controllers/subsystem/server_maint.dm @@ -19,6 +19,9 @@ SUBSYSTEM_DEF(server_maint) world.hub_password = "" //quickly! before the hubbies see us. /datum/controller/subsystem/server_maint/Initialize() + if (fexists("tmp/")) + fdel("tmp/") + if (CONFIG_GET(flag/hub)) world.update_hub_visibility(TRUE) //Keep in mind, because of how delay works adding a list here makes each list take wait * delay more time to clear @@ -82,6 +85,8 @@ SUBSYSTEM_DEF(server_maint) return /datum/controller/subsystem/server_maint/Shutdown() + if (fexists("tmp/")) + fdel("tmp/") kick_clients_in_lobby(span_boldannounce("The round came to an end with you in the lobby."), TRUE) //second parameter ensures only afk clients are kicked var/server = CONFIG_GET(string/server) for(var/thing in GLOB.clients) diff --git a/code/modules/asset_cache/asset_list.dm b/code/modules/asset_cache/asset_list.dm index e4a00ffb8bf38..bc302a188d825 100644 --- a/code/modules/asset_cache/asset_list.dm +++ b/code/modules/asset_cache/asset_list.dm @@ -1,4 +1,4 @@ -#define ASSET_CROSS_ROUND_CACHE_DIRECTORY "tmp/assets" +#define ASSET_CROSS_ROUND_CACHE_DIRECTORY "cache/assets" //These datums are used to populate the asset cache, the proc "register()" does this. //Place any asset datums you create in asset_list_items.dm diff --git a/config/config.txt b/config/config.txt index 2c552361c6bb4..1c87fc110ae9a 100644 --- a/config/config.txt +++ b/config/config.txt @@ -532,9 +532,9 @@ URGENT_AHELP_COOLDOWN 300 MOTD motd.txt #MOTD motd_extra.txt -## Assets can opt-in to caching their results into `tmp`. +## Assets can opt-in to caching their results into `cache/`. ## This is important, as preferences assets take upwards of 30 seconds (without sleeps) to collect. -## The cache is assumed to be cleared by TGS recompiling, which deletes `tmp`. +## The cache is assumed to be cleared by TGS recompiling, which deletes `cache/`. ## This should be disabled (through `CACHE_ASSETS 0`) on development, ## but enabled on production (the default). CACHE_ASSETS 0