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

[NV-3009] 🚀 Feature: Typescript SDK - Add Exponential Retry Mechanism with Idempotency Headers #4452

Closed
5 tasks
Cliftonz opened this issue Oct 6, 2023 · 8 comments · Fixed by #4462
Closed
5 tasks
Assignees
Labels
help wanted Extra attention is needed Improvement Created by Linear-GitHub Sync @novu/node Novu NodeJs SDK
Milestone

Comments

@Cliftonz
Copy link
Contributor

Cliftonz commented Oct 6, 2023

In order to enhance the resilience and reliability of our SDK, we would like to introduce an Exponential Retry mechanism for retrying failed requests. Additionally, to ensure the idempotent processing of requests, it's vital to incorporate support for providing an Idempotency Key as per the draft specified in the HTTP Idempotency Key Header Field.

The key requirements for this implementation include:

  1. Exponential Retry Mechanism:
    • The SDK should retry failed requests following an exponential backoff strategy to minimize the contention and impact on the systems involved.
    • The SDK should ensure that the retry mechanism is configurable (e.g., max retries, initial delay, maximum delay).
  2. Idempotency Key Provisioning:
    • The SDK should allow for either automatic or manual provisioning of an Idempotency Key for each request.
    • The Idempotency Key should conform to either CUID, ULID, or UUID formats as specified in the draft.
    • The Idempotency Key should be included in the HTTP Header as Idempotency-Key and following the standards outlined in the draft.
  3. Configuration and Documentation:
    • The SDK should provide configuration options for enabling/disabling the Exponential Retry mechanism and Idempotency Key provisioning.
    • Comprehensive documentation should be provided explaining the configuration options, operational behavior, and the benefits of using the Exponential Retry mechanism along with Idempotency Keys.

Acceptance Criteria:

  • Implementation of the Exponential Retry mechanism with configurable parameters.
  • Provisioning of Idempotency Keys, either automatically or manually, conforming to specified formats (CUID, ULID, or UUID).
  • Adequate unit and integration testing to ensure the robustness and reliability of the implemented features.
  • Comprehensive documentation on the usage and configuration of the Exponential Retry mechanism and Idempotency Key provisioning.
  • Adherence to the specifications outlined in the HTTP Idempotency Key Header Field draft.

Please refer to the draft for further details on the HTTP Idempotency Key Header Field and ensure adherence to the specified standards while implementing this feature in the SDK.

Update: You can reference the go-lang library to keep the method signature and configuration the same.
novuhq/go-novu#62

From SyncLinear.com | NV-3009

@Cliftonz Cliftonz changed the title 🚀 Feature: Typescript SDK - Add Exponential Retry Mechanism with Idempotency Headers [NV-3009] 🚀 Feature: Typescript SDK - Add Exponential Retry Mechanism with Idempotency Headers Oct 6, 2023
@Cliftonz Cliftonz added help wanted Extra attention is needed @novu/node Novu NodeJs SDK Improvement Created by Linear-GitHub Sync labels Oct 6, 2023
@michaldziuba03
Copy link
Contributor

  1. There is popular extension for underlying http library used by SDK: axios-retry
  2. I'm little bit confused - does server reads Idempotency-Key header and implement any idempotency mechanism?

@Cliftonz
Copy link
Contributor Author

Cliftonz commented Oct 6, 2023

@michaldziuba03 Thanks for adding that library.

As to number 2, not yet but we are looking to add it soon.

I wanted to get this out during hacktoberfest if anyone was brave enough.

@michaldziuba03
Copy link
Contributor

@Cliftonz ok, I think I'm brave enough :)

@Cliftonz
Copy link
Contributor Author

Cliftonz commented Oct 6, 2023

@michaldziuba03 I would be happy to assign this to you, feel free to reach out if you have any questions or need to talk through anything on idempotency.

@Marrwan
Copy link

Marrwan commented Oct 7, 2023

Is this assigned already

@Cliftonz
Copy link
Contributor Author

Cliftonz commented Oct 7, 2023

Is this assigned already

Yes

@mahendraHegde
Copy link
Contributor

mahendraHegde commented Oct 8, 2023

@michaldziuba03 i have added the same for golang sdk, may be we should keep the signature same
novuhq/docs#187
novuhq/go-novu#62
@Cliftonz

@Cliftonz
Copy link
Contributor Author

Cliftonz commented Oct 8, 2023

I agree, you made a very good implementation out of these requirements.

@michaldziuba03 i have added the same for golang sdk, may be we should keep the signature same novuhq/docs#187 novuhq/go-novu#62 @Cliftonz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed Improvement Created by Linear-GitHub Sync @novu/node Novu NodeJs SDK
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants