snowplow-javascript-tracker
snowplow-javascript-tracker copied to clipboard
Consider returning a promise from flush method in node tracker
Is your feature request related to a problem? Please describe.
Currently gotEmitter
's flush method is not async and returns void instead of a promise.
This makes it harder to use in environments where a promise is needed to ensure all async tasks complete before exiting (e.g. AWS Lambda async handlers).
Describe the solution you'd like
flush
is async/returns a promise.
Describe alternatives you've considered At the moment the way to ensure flush completes in such environments is to wrap the emitter in a promise, and configure it with a callback that resolves and rejects that promise.
I've often pondered if we should "promisify" the whole tracker...