First Cloud Code request takes 6-15 seconds

Hello!
I’m using CloudCode to obfuscate some endpoints. The module itself is pretty simple- it takes a string in and returns a different string based on a switch statement.

When I launch the game (PC & Steam) via editor or full build, I end up waiting anywhere from 6-15 seconds to get the first response back on the function that requests that string.
Further uses of that function seem to come back nearly instantly. And, if I close and relaunch (or stop and restart the editor), there’s a good chance the time will drop significantly for the first request- though I still see extended first-run times randomly.

Is this expected? Or is there something I can do to ‘pre-warm’ the code? I currently use it just after player sign-in.

Simplified Engine Code:


try{
    Debug.Log("Getting Cloud Code item: " + _str);  // Gives me a "start" time for a given call
    NetHandlerBindings module = new NetHandlerBindings(CloudCodeService.Instance);  
    _target = await module.GetAssociatedStr(_str);
    Debug.Log("Cloud code finished: " + _str);  // Gives me a end time for the call. 
    return _target;
}

Simplified Cloud Code:

public string GetAssociatedStr(string _str)
{
    switch (_str)
    {
        case "abc":
            return abcStr;
       // continues with other switch cases, aprx 10 in total

Any help on this is really appreciated!

Perhaps this?

Ah- I should have RTFM!

For anyone else seeing this, this exert from the linked documentation is probably what’s going on:

Important : If a module hasn’t received any traffic in the last 15 mins, you might experience a cold start latency. Any subsequent calls to the module are faster.

There’s also some info about cold-starts in best-practices here

What it doesn’t specify is what that “cold start latency” looks like- but I’m guessing its what I’m experiencing.

So, lesson learned- double check the documentation!