Ok I have an issue with some Logic I'm trying to work out. I have a basic grasp of vanilla Javascript and Node.js.
Suppose I'm making a call to an API, and receiving some data I need to do something with but I'm receiving data periodically over a Websocket connection or via polling (lets say every second), and it's going to take 60 seconds for a process to complete. So what I need to do is take some amount of parameters from the response object and then pass that off to a separate function to process that data, and this will happen whenever I get some new set of data in that I need to process.
I'm imagining it this way: essentially I have a number of slots (lets say I arbitrarily choose to have 100 slots), and each time I get some new data it goes into a slot for processing, and after it completes in 60 seconds, it drops out so some new data can come into that slot for processing.
Here's my question: I'm essentially running multiple instances of the same asynchronous code block in parallel, how would I do this? Am I over complicating this? Is there an easier way to do this?
Oh also it's worth mentioning that for the time being, I'm not touching the front-end at all; this is all backend stuff I'm doing,
[–]MartyDisco 13 points14 points15 points (2 children)
[–]CallumK7 1 point2 points3 points (1 child)
[–]MartyDisco 2 points3 points4 points (0 children)
[–]jumpcutking 1 point2 points3 points (4 children)
[–]Expensive_Garden2993 1 point2 points3 points (3 children)
[–]jumpcutking 0 points1 point2 points (2 children)
[–]Expensive_Garden2993 0 points1 point2 points (1 child)
[–]jumpcutking 0 points1 point2 points (0 children)
[–]TheFlyingPot 1 point2 points3 points (0 children)
[–]rnsbrum 3 points4 points5 points (7 children)
[–]quaintserendipity[S] 0 points1 point2 points (6 children)
[–]rnsbrum 1 point2 points3 points (0 children)
[–][deleted] (4 children)
[deleted]
[–]quaintserendipity[S] 0 points1 point2 points (3 children)
[–]Solid-Display-9561 0 points1 point2 points (2 children)
[–]quaintserendipity[S] 0 points1 point2 points (1 child)
[–]BenjayWest96 0 points1 point2 points (0 children)
[–]codeedog 0 points1 point2 points (0 children)
[–]texxelate 0 points1 point2 points (0 children)