Adding to Zlatko anwser, You definitely need a queuing system (or probably is using it already). That is because it's a long running job from what I understand (as you mentioned magnitude of hours). The queuing system can be a simple custom solution based on a database or even plain filesystem or full-fledged queueing systems like ActiveMQ etc. You can implement without a queueing system as well, but this makes the program very robust and can survive restarts etc.
Now all you need to do is embed a batchId for each batch request that the user is submitting. So the support user can reload the web page etc and see that his batch is in progress and have option to cancel it if needed. Now he can press the cancel button to request a cancellation of his process and this will mark that batch with batchId as cancelled in a table or a variable. Now in between processing the batch job processor can check if the batchId is cancelled or not. It will process the items from the batch only if the batchId is not cancelled otherwise it will drain the remaining workItems if using a queuing system (or delete from table, if using a database system) and mark the batch as cancelled. Cheers Murukesh On Sunday, 11 March 2018 21:47:46 UTC+5:30, MrNode wrote: > > *Create a mechanism to support a long running task where we can solve for > the mentioned scenario:* > > A support user starts a baseline upload for an organization. The baseline > upload had 100000 rows in the CSV file uploaded, and the support user - > right after clicking the “Start” button - realizes that he seemed to have > wrongly exchanged data between two adjacent columns. Subsequently, the > support user would need to wait until the current request completes, which > can be in the magnitude of hours, and since we don't allow 2 concurrent > baseline uploads in Labs right now, this implies he would not be able to > upload the correct file till this task completes. Once done, the user would > need to remove those 1 lac entries, and finally upload the correct file. > > How I can write code in Node.js to solve this problem. > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/4ac3c4f8-4883-43ca-a45d-16e9fd957122%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
