Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core/write): allow to supply listener for write failures #201

Merged
merged 3 commits into from
Jun 11, 2020

Conversation

sranka
Copy link
Contributor

@sranka sranka commented Jun 9, 2020

Fixes #197

Proposed Changes

The following property was added to writeOptions, so it is now possible to know/observe/react upon writing failures in a custom way.

  /*
   * writeFailed is called to inform about write error
   * @param this the instance of the API that failed
   * @param error write error
   * @param lines failed lines
   * @param attempts a number of failed attempts to write the lines
   * @return a Promise to force the API to not retry again and use the promise as a result of the flush operation,
   * void/undefined to continue with default retry mechanism
   */
  writeFailed(
    this: WriteApi,
    error: Error,
    lines: Array<string>,
    attempts: number
  ): Promise<void> | void

Checklist

  • CHANGELOG.md updated
  • A test has been added if appropriate
  • yarn test completes successfully
  • Commit messages are in semantic format
  • Sign CLA (if not already signed)

@sranka sranka added the enhancement New feature or request label Jun 9, 2020
@sranka sranka force-pushed the 197/writeFailed_listener branch from 2e7d0b9 to edfea7f Compare June 9, 2020 15:17
@sranka sranka marked this pull request as ready for review June 9, 2020 17:00
@sranka sranka requested review from bednar and vlastahajek June 10, 2020 09:28
@sranka sranka force-pushed the 197/writeFailed_listener branch from edfea7f to 5470591 Compare June 10, 2020 15:01
Copy link
Contributor

@vlastahajek vlastahajek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work.

@sranka sranka merged commit e4f313b into master Jun 11, 2020
@sranka sranka deleted the 197/writeFailed_listener branch June 11, 2020 04:06
@sranka sranka mentioned this pull request Jun 12, 2020
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

error handling for writePoint/writePoints
3 participants