Skip to content

fix: await async custom dispatcher during telemetry sync - #63

Open
danishsshaikh wants to merge 1 commit into
project-sunbird:developfrom
danishsshaikh:fix/await-async-custom-dispatcher
Open

fix: await async custom dispatcher during telemetry sync#63
danishsshaikh wants to merge 1 commit into
project-sunbird:developfrom
danishsshaikh:fix/await-async-custom-dispatcher

Conversation

@danishsshaikh

Copy link
Copy Markdown

Summary

Fixes #62.

This PR allows custom telemetry dispatchers to return a Promise and ensures async dispatcher failures are handled by the existing retry flow.

Problem

The SDK supports custom dispatchers, but TelemetrySyncManager called dispatcher.dispatch(...) without await. If a custom dispatcher returned a rejected Promise, the surrounding try/catch would not catch the error, so failed batches could bypass retry handling.

Changes

  • Updated the custom dispatcher type to allow void | Promise<unknown>.
  • Awaited custom dispatcher calls in normal sync and retry sync paths.
  • Added a regression test for rejected async custom dispatchers.

Validation

  • npm test — 36 tests passed
  • npm run build — CJS, ESM, IIFE, and DTS builds passed
  • npm run lint — completed with no lint errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant