This topic contains 1 reply, has 0 voices, and was last updated by david.smith 7 years, 7 months ago.

  • Author
    Posts
  • #967

    WakaWaka

    The documentation seems to provide no details beyond that yielding is handled for you. However, I have noticed odd behavior. For example, I counter I have as a global variable that gets incremented in my map stage will get reset whenever the script yields.

    So when the script yields, do I loose everything in memory? Or am I running a poor test or misunderstanding something?

    If I’m right, what’s the best way to deal with this? The best I can think of is to check how much governance is left and try to save everything to the cache or a custom record and resume it when the script starts again. That sounds like a terrible thing to have to do however.
    This is a cached copy. Click here to see the original post.

  • #968

    david.smith

    With Map/Reduce you have to treat each info/map/reduce/summary as it’s own script. You cannot pass standard variables between the stages. The scope is also reset for each pass. So a global variable, like you might have in a scheduled script, will not work.

    If you need to keep track of or pass information, take a look at the N/cache module.

You must be logged in to reply to this topic.