If I have a user event trigger a map reduce using ...
# suitescript
a
If I have a user event trigger a map reduce using the N/task module, and it gets triggered by 2 different records, will the 2nd one fail or enter a queue?
s
not positive but I think you'll get an error saying it's already running?
a
That's what I thought. Is there any (simple) way I can add it to a queue?
k
Add another deployment of the mapreduce
a
And then what? If is processing use the other one?
Not a bad idea but that isn't really a queue. What would happen if there 3 then?
k
When sending the task do not specify a deploymentid and it will use the next one available.
I would be careful though as if this record that is triggering the mapreduce is triggering a lot then not sure this is the best way to go as you would need many many deployments
a
When sending the task do not specify a deploymentid and it will use the next one available.
Really? Good to know.
k
Yep really. I do it all the time 😂
s
but I believe that's still subject to the limit - if a deployment isn't available you'll get an error?
k
Yep
You could add 10 but if ten records trigger the mr then no more available.
a
I would definitely hope not to get to 10. I am worried about a theoretical 2 or 3
Thanks for the help!
k
No worries!
n
You can also capture the failure if you don't have enough deployments at the time the task is submitted and created a new deployment on the fly. No need to have a static number of deployments and no need to then worry you don't have enough. @Azi
a
@NElliott Thanks. I had that thought. But I wasn't sure if deployment could be created in code