-
Notifications
You must be signed in to change notification settings - Fork 147
Description
My Problem is related to the version 3.0.0-beta.7
Tried to find some related issues but I didn't find anything close to it.
I have been using an AWS Lambda and the Highland libary with some functionality on top of it. (With the new use operator).
Everything worked like a charm until I started to use doto with an async function. When I try to consume the stream via toPromise(...), it seems that the Promise resolves before every asynchronous doto function resolved/finished. The resulting problem is, that the overall promise resolves too early, my Lambda considers his tasks as finished and aborts every ongoing request (as the process is ending) that is still pending.
However, that does not happen if I use the done operator with an callback (So no promises involved).
The question now is, as doto is only for side effects and async side effects are somehow hard to "track", could this be considered a bug or just a coincidence that has to be considered?
Thanks in advance.
Code Snippets
return ...
.publishToIoTBroker(`${event.topic}/valid`) // <- My custom operator
.toPromise(Promise);function publishToIoTBroker(...) {
...
return this.doto(async data => {
...
await iotBroker.publish(...).promise()
});
}