Friday 21 September 2018

Best way to implement a transaction queue in my Node app?

Basically, currently I have a REST API on Node+Express that takes about ~40 seconds (or more) to process the request (encode and store some data) and return a response (receipt).But a 40-second response tine is not very nice, and I want to implement a system that allows me to return a promise or an ID of the transaction instantly whenever it is requested, and put the said transaction into a queue for it to be processed so that the API caller doesn't have to wait almost a minute or sometimes even more to get a response, and instead get something that is able to look up if the transaction has succeeded later.Ideally this should be able to handle simultaneous/very consecutive calls too, as long as I can return some response to check the results later. Transaction processing time doesn't matter, as long as it is in the queue and it is going to be executed.Thanks in advance!

Submitted September 21, 2018 at 10:09PM by thunderforce41

No comments:

Post a Comment