I'm building a fairly simple M/R. In the getInput,...
# suitescript
j
I'm building a fairly simple M/R. In the getInput, it's running a search to grab a bunch of records and some field values. I'll be taking those values and pinging an endpoint (webhook) to get an XML doc in return. I'll parse the XML and update the records accordingly. My question is... should I put the pinging of the webhook in the map or the reduce stage? I'll be also using the reduce stage to update my records in NS. Not sure if there is a best practices way of doing this and want to save myself future headaches. Thanks!
b
if you are only getting information from the endpoint and not actually writing anything, you can probably do anything you want
which would probably be doing everything in the map and saving the reduce for expansion
if your map becomes takes too long, and writes data externally, then you may want to use the reduce to minimize the logic you need to recover from a System Response After a Map/Reduce Interruption
the scenario you would want to avoid is writing data twice to your endpoint
j
Ok, thanks. I'm just pinging the webhook to make sure that the data is correct (it's addresses and the webhook validates them). No external writing of data. Just grabbing the info and updating my address records to match official postal records. I posed the question because my map stage is like 10 lines long and the reduce stage is reaching 100 lines. Didn't want to overload one stage or something like that. Trying to ingrain best practices in my brain.
k
Usually I go to the reduce stage because of the extra governance if I don't have any grouping to do. But that's more of a preference than a standard.