snowplow / snowplow/snowplow-javascript-tracker

Consider returning a promise from flush method in node tracker

Open
#1,087 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:enhancement
Dominant language
TypeScript
Stars
590
Forks
232
Avg merge
2h 22m
Merged PRs (30d)
3

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the gotEmitter flush implementation and its existing callback path. Trace how asynchronous tasks signal completion, then verify that flush resolves or rejects only after those tasks finish and that existing callback behavior remains covered by the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, node.js, typescript
Domain
backend, cloud
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.