question

Kim Strasser avatar image
Kim Strasser asked

Rule is not triggered but the condition was fulfilled

CloudScript function:

handlers.Test = function (args, context)
{
    var updatesuccessful = false;
    ...
    updatesuccessful = true;

    var result = {
        ...
        "Successful": updatesuccessful
    };
    
    return result;
}

In the client I call this CloudScript function and if everything was successful in this function then I want that a rule is triggered. I created a rule and I defined the following condition:

The PlayStream event of the CloudScript function looks like this after the client called it:

"CloudScriptExecutionResult": {
        "FunctionName": "Test",
        "ExecutionTimeSeconds": 0.4202419,
        "ProcessorTimeSeconds": 0.004855,
        "MemoryConsumedBytes": 27856,
        "HttpRequestsIssued": 0,
        "APIRequestsIssued": 5,
        "FunctionResult": {
            "Successful": true,
            ...
        },

"Successful": true but the rule is not triggered. The condition should be fulfilled in this case and then a different CloudScript function should be executed.

Why is the rule not triggered when "Successful": true ?

CloudScript
4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Seth Du avatar image Seth Du ♦ commented ·

Hi, may I know which event does this rule is monitoring?

0 Likes 0 ·
Kim Strasser avatar image Kim Strasser Seth Du ♦ commented ·

I created two new CloudScript functions for testing and I executed the function "MyTest" in a player's account in Game Manager. I get this PlayStream event for this function:

"EventName": "player_executed_cloudscript",
    "Source": "CloudScript",
    "FunctionName": "MyTest",
    "CloudScriptExecutionResult": {
        "FunctionName": "MyTest",
        "Revision": 543,
        "FunctionResult": {
            "MyText": "NewTest",
            "Successful": true,
            "MyBool": false
        },

But the function "MyTest1" is not triggered by the rule. Is something wrong in the settings of my rule?

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Kim Strasser commented ·

The Rule configuration indicates that it monitors a customized event named "MyTest". However, the execution of a Cloud Script generates an event named "player_executed_cloudscript".

Would you provide more details about the scenario?

0 Likes 0 ·
Show more comments

1 Answer

·
Seth Du avatar image
Seth Du answered

According to your description, it is not recommended to implement too many APIs (almost reaching the limit) calls in a function unless it is necessary. Beside of amount limit, there is also runtime limit. Even though for most of the time the runtime of a Restful call is stable, it should be better to preserve some time to improve robustness.

You may monitor player_executed_cloudscript event in a Rule where specified error can be added in Condition section.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.