Wednesday 21 November 2018

Web app running into issues when multiple users upload files at the same time

I am quite new to node/javascript in general and I have an issue with my angular app that has the traditional client and server running on nginx. There's an authentication functionality that requires users to log in. Separate users can use the app to upload files, extract the data, store that information in a local sql database using sequelize, and then update the processed data in an AS400 database using odbc drivers.The problem comes up when the users hit the submit and confirm buttons on upload at the same time. As the processing of each request by the server can take up to a minute, different users uploading at the same time can cause the app to crash, suddenly returning partial results or undefined errors from null array values. I am not sure where the problem is because I tracked the progress of the data through the app's async/await functions and it stops in the back end, with arrays full of data objects suddenly being reset to empty.Could this because the app is not using object instances? Here is how I reference the document-upload.js file:const uploadHelper = require('./document-upload'); Here is how I call the methods in that file:await uploadHelper.processFile(file.path); const batches = await uploadHelper.getBatches(user, file); Would a possible fix to this be to create multiple object instances of the uploadHelper so that there's no interference between different users? Or is this an issue elsewhere?

Submitted November 21, 2018 at 04:53PM by dealin92

No comments:

Post a Comment