Sign In Register

How can we help you today?

Start a new topic
Answered

Start getting "Long running script, terminating" in our ClodCode from 18.09!

Hi!


Starting from 18.09 we are getting this error on our live server in our CloudCode script:

  

// ====================================================================================================
//
// Cloud Code for ChallengeStartedMessage, write your code here to customise the GameSparks platform.
//
// For details of the GameSparks Cloud Code API see https://portal.gamesparks.net/docs.htm			
//
// ====================================================================================================
var challenge = Spark.getChallenge(Spark.getData().challenge.challengeId);
var creator = challenge.getChallengerId();
var creatorObj = Spark.loadPlayer(creator);
var nextTurn = Spark.getData().challenge.nextPlayer;
var rivalObj = Spark.loadPlayer(challenge.getChallengedPlayerIds()[0]);
var player1Pic = creatorObj.getScriptData("avatar") || "";
var player2Pic = rivalObj.getScriptData("avatar") || "";

//This creates our variable for the challenge, you can create as many as you want.
var playerOneScore = 0;
var playerTwoScore = 0;
var player1Turns = 0;
var player2Turns = 0;
var challengeRound = 1;
var last_turn = new Date();
last_turn = last_turn.getTime();
 
//We then set our Script Data for the challenge with a key of "playerOneScore" and our variable as the data to send.
challenge.setScriptData("player1Score", playerOneScore);
challenge.setScriptData("player2Score", playerTwoScore);
challenge.setScriptData("player1Turns", player1Turns);
challenge.setScriptData("player2Turns", player2Turns);
challenge.setScriptData("challengeRound", challengeRound);
challenge.setScriptData("player1Pic", player1Pic);
challenge.setScriptData("player2Pic", player2Pic);
challenge.setScriptData("last_turn", last_turn);
//This data will be stored in the database for this challenge's instance

if (nextTurn != creator) {
    challenge.consumeTurn(nextTurn);   
}

  

Can anyone help us to recognize a problem?


Best Answer

Hi Aleksey,


We've addressed this issue with you in a ticket but I'm just posting the info here for the benefit of others. We monitor scripts carefully to ensure they aren't running too long, but this system may have been too aggressive in some instances. The Dev Team has pushed out a fix for this so all should be well now.


Thanks,

Liam

          


1 Comment

Answer

Hi Aleksey,


We've addressed this issue with you in a ticket but I'm just posting the info here for the benefit of others. We monitor scripts carefully to ensure they aren't running too long, but this system may have been too aggressive in some instances. The Dev Team has pushed out a fix for this so all should be well now.


Thanks,

Liam

          


Login to post a comment