From 22ae5924727759dc4861ec5f2a463f2baae4d439 Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Fri, 7 Apr 2023 11:48:05 -0700 Subject: [PATCH] Increase first connect responsiveness by delaying vox sound preload (#74559) These were getting sent too early and clogged up the queue of resources to send the client, delaying chat load if the client had no byond rsc cache and the cdn was not enabled. Also this way if the cdn rsc download happens quick enough than these calls can become noops. (if byond isn't smart enough to do that now, it will be.) --- code/modules/client/client_procs.dm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 30175a6b4db..8de01bf0fa7 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -1005,7 +1005,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list( preload_rsc = external_rsc_urls[next_external_rsc] #endif - spawn (10) //removing this spawn causes all clients to not get verbs. + spawn (10) //removing this spawn causes all clients to not get verbs. (this can't be addtimer because these assets may be needed before the mc inits) //load info on what assets the client has src << browse('code/modules/asset_cache/validate_assets.html', "window=asset_cache_browser") @@ -1015,12 +1015,16 @@ GLOBAL_LIST_INIT(blacklisted_builds, list( addtimer(CALLBACK(SSassets.transport, TYPE_PROC_REF(/datum/asset_transport, send_assets_slow), src, SSassets.transport.preload), 5 SECONDS) #if (PRELOAD_RSC == 0) - for (var/name in GLOB.vox_sounds) - var/file = GLOB.vox_sounds[name] - Export("##action=load_rsc", file) - stoplag() + addtimer(CALLBACK(src, TYPE_PROC_REF(/client, preload_vox)), 1 MINUTES) #endif +#if (PRELOAD_RSC == 0) +/client/preload_vox() + for (var/name in GLOB.vox_sounds) + var/file = GLOB.vox_sounds[name] + Export("##action=load_rsc", file) + stoplag() +#endif //Hook, override it to run code when dir changes //Like for /atoms, but clients are their own snowflake FUCK