Hello all, I am working on a Map/Reduce script tha...
# suitescript
m
Hello all, I am working on a Map/Reduce script that has to edit around 40,000 items. It originally was done by a scheduled script, but obviously it runs out of usage. The issue I am running into is that the Map/Reduce script is stopped after an hour because of the time limit that it has. Scheduling it seems like the only way to get this to work, but I dont need to run this script very often. (it is supposed to go through the items and set the lowest priced vendor to the preferred vendor.) Does anyone have any pointers or suggestions on how to get this script to get through all of the items without running out of usage or hitting the time limit? Or a work around?
n
The “time limit” is just how long it runs before yielding to other map/reduce or scheduled scripts. It will keep going after that hour mark if you let it run. If you are in fact seeing it stop without doing all 40k, I’d venture a guess you are returning a search or query out of getInput. Which I believe will only process the first 1000.
🎯 1
Although googling that search thing to confirm I may be wrong on the number. The map/reduce won’t time out though. https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4387799161.html#bridgehead_1518486832
Check on the section on “Map/reduce scripts permit yielding and other interruptions”
m
Thank you for sending that info, yes I am running a search in the getInput but I am using runPaged which is supposed to increase the limit from my understanding. I will re-read the documentation, maybe there is something I missed
b
Share the code of getInputData pls. One thing to may want to try is extracting all of the results to an array in the getInputData stage and passing that to the next stage, ensuring that you are retrieving all of the results and see if it still stops after an hour.