This topic contains 3 replies, has 0 voices, and was last updated by cblackburn 7 years, 11 months ago.

  • Author
    Posts
  • #1391

    CREECE

    Is forEach still to be avoided and a “regular” for loop used so that the scripts yield appropriately? Is this true for all script types?
    This is a cached copy. Click here to see the original post.

  • #1392

    cblackburn

    In SS 2.0 yielding is handled automatically for Map/Reduce scripts; nothing special needs to be done wrt to Arrays, any native ECMA5.1 language feature is fair game. Note that 2.0 Scheduled scripts do not support yielding, however they can still be recursively re-invoke themselves using the N/task module.


    ironside replied on 12/30/2016, 12:46 AM: ‘yielding’ in SS1.0 was always broken imho anyway. Good riddance.

  • #1393

    CREECE

    I know I don’t need to explicitly do anything in a map/reduce, but in 1.0, a script couldn’t yield in array methods and I didn’t see any doc regarding that in 2.0. For instance, if i’m in in my reduce phase and I have an array of ids that I need to check some value on using a governance related operation, if i use array.forEach in a 1.0 script and it runs out of governance, it cannot yield. In 2.0, you are saying this is valid though?

  • #1394

    cblackburn

    That’s right, there is no such restriction in 2.0.


    CREECE replied on 12/16/2016, 08:22 PM: Thanks very much for your help! Much appreciated.

You must be logged in to reply to this topic.