I have a piece of code like so:
Debug.Log("Player who won: " + playfabPreviouslyConnectedPlayers[wonPlayer]); PlayFabServerAPI.ExecuteCloudScript(new PlayFab.ServerModels.ExecuteCloudScriptServerRequest() { PlayFabId = playfabPreviouslyConnectedPlayers[wonPlayer], FunctionName = "playerWonOnlineMatch", FunctionParameter = ***, GeneratePlayStreamEvent = true, // Optional - Shows this event in PlayStream }, OnWinSuccess, OnWinError); PlayFab.ServerModels.WriteTitleEventRequest request = new PlayFab.ServerModels.WriteTitleEventRequest { EventName = "online_game_complete", Body = new Dictionary<string, object>{ { "Players", playfabPreviouslyConnectedPlayers } *** } }; PlayFabServerAPI.WriteTitleEvent(request, result => Debug.Log("Player Won Playstream Written"), error => Debug.LogError("Error writing error to playstream: " + error.ErrorMessage));
In my server, I get the log for the first debug option at 4 seconds:
{"log":"Player who won: 2A96DFDBE6056076\r\n","stream":"stdout","time":"2021-11-09T13:41:04.568905Z"}
Then, I get the responses to these two calls 11 seconds later:
{"log":"Player Won Playstream Written\r\n","stream":"stdout","time":"2021-11-09T13:41:15.8661417Z"} {"log":"GameManager:OnWinSuccess (PlayFab.ServerModels.ExecuteCloudScriptResult) (at D:/***:3625)\r\n","stream":"stdout","time":"2021-11-09T13:41:16.1011492Z"}
The playstream event is here for the "OnWinSuccess":
{ "PlayFabEnvironment": { "Application": "logicserver", "Vertical": "master", "Commit": "74c29bd", "Cloud": "main" }, "EventNamespace": "com.playfab", "Timestamp": "2021-11-09T13:41:15.9989856Z", "SourceType": "BackEnd", "EntityType": "player", "EventName": "player_executed_cloudscript", "EntityId": "2A96DFDBE6056076", "EventId": "048ca30d38194dd8acfbc3276a14442d", "TitleId": "E159E", "FunctionName": "playerWonOnlineMatch", "CloudScriptExecutionResult": { "FunctionName": "playerWonOnlineMatch", "ExecutionTimeSeconds": 0.0363139, "ProcessorTimeSeconds": 0.001719, "MemoryConsumedBytes": 5216, "HttpRequestsIssued": 0, "APIRequestsIssued": 1, "FunctionResult": { "messageValue": "Player Won: 2A96DFDBE6056076 Match time: 295.5024", "amount": 94 }, "Revision": 115, "Logs": [ { "Level": "Info", "Message": "Player Won: 2A96DFDBE6056076 Match time: 295.5024" } ] }, "Source": "CloudScript" }
The timestamp in the playstream event is at 16 seconds, same as when the return is received in my server, execution time is 0.03 in the cloudscript, so it seems it takes 11 seconds for cloudscript to receive the call but almost none for it to be returned.
Why is that? What could I do to fix this?