1

I am trying to use the javascript setTimeout command to delay the updating of a Participant in hyperledger playground.

/**
@param {org.acme.model.createMessage} msg
@transaction
*/
function createMessage(msg)
{  
    setTimeout(function() {
      console.log(msg);
      return getParticipantRegistry('org.acme.model.User')
        .then(function (participantRegistry) {
            msg.message.recipient.emailReceived = msg.message.message;
            return participantRegistry.update(msg.message.recipient);
        });  
    }, 10000);  
}

The console log outputs the Asset msg correctly but I can't get the Participant to be updated. I have tried taking the return statement outside of the setTimeout and this correctly performs the desired behaviour. Is this possible to achieve in the hyperledger playground?

rtn
  • 31
  • 1

0 Answers0