asynquence | Asynchronous flow control ( promises generators | Reactive Programming library
kandi X-RAY | asynquence Summary
kandi X-RAY | asynquence Summary
Promise-style async sequence flow control.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of asynquence
asynquence Key Features
asynquence Examples and Code Snippets
Community Discussions
Trending Discussions on asynquence
QUESTION
I have a server-side Node.JS script that handles file uploads by (1) saving the upload to a specific location and (2) recording it in a DB. I have been using the Asynquence library and its gate function (equivalent to Promise.all) to perform these steps in parallel, but I need the sequence to behave so that if either step fails, I undo the other step if it succeeded. Obviously the undoing steps can only execute if its matching step has already succeeded (i.e removing the file or db record)
Gate doesn't seem to work for this case since it fires the error handler if any of the steps fail. Is there a function that waits for all steps to either succeed or fail?
...ANSWER
Answered 2017-Apr-10 at 15:10If you think of catch
as an asynchronous counterpart to try
, then you can build a quick wrapper that wraps every value passed to gate
or Promise.all
and returns a "succeeded" or "failed" result.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install asynquence
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page