[MIRROR] Removes the persistent hold on a tmp savefile. (#2841)

* Removes the persistent hold on a tmp savefile. (#56320)

This was surviving soft reboots and then blocking the deploy of a new code version.

There is zero need to persist this savefile given the low amount of times this proc is called.

* Removes the persistent hold on a tmp savefile.

Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com>
This commit is contained in:
SkyratBot
2021-01-23 17:35:08 +00:00
committed by GitHub
co-authored by Kyle Spier-Swenson
parent 4451cbd5a4
commit a45c4f9514
+7 -8
View File
@@ -1099,11 +1099,6 @@ GLOBAL_LIST_INIT(freon_color_matrix, list("#2E5E69", "#60A2A8", "#A1AFB1", rgb(0
alpha += 25
obj_flags &= ~FROZEN
/// Save file used in icon2base64. Used for converting icons to base64.
GLOBAL_DATUM_INIT(dummySave, /savefile, new("tmp/dummySave.sav")) //Cache of icons for the browser output
/// Generate a filename for this asset
/// The same asset will always lead to the same asset name
/// (Generated names do not include file extention.)
@@ -1119,10 +1114,14 @@ GLOBAL_DATUM_INIT(dummySave, /savefile, new("tmp/dummySave.sav")) //Cache of ico
/proc/icon2base64(icon/icon)
if (!isicon(icon))
return FALSE
WRITE_FILE(GLOB.dummySave["dummy"], icon)
var/iconData = GLOB.dummySave.ExportText("dummy")
var/savefile/dummySave = new("tmp/dummySave.sav")
WRITE_FILE(dummySave["dummy"], icon)
var/iconData = dummySave.ExportText("dummy")
var/list/partial = splittext(iconData, "{")
return replacetext(copytext_char(partial[2], 3, -5), "\n", "")
. = replacetext(copytext_char(partial[2], 3, -5), "\n", "") //if cleanup fails we want to still return the correct base64
dummySave.Unlock()
dummySave = null
fdel("tmp/dummySave.sav") //if you get the idea to try and make this more optimized, make sure to still call unlock on the savefile after every write to unlock it.
/proc/icon2html(thing, target, icon_state, dir = SOUTH, frame = 1, moving = FALSE, sourceonly = FALSE)
if (!thing)