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

fix(retry): BaseRetryHandler + Make Retry in general easier to play with #88

Merged
merged 5 commits into from
Mar 31, 2021

Conversation

kelvin-lu
Copy link
Contributor

@kelvin-lu kelvin-lu commented Mar 14, 2021

Summary

Begins to address issues highlighted by #86 :

  • exports Retry directly form @amplitude/node so that a second dep isn't necessary

  • exports BaseRetryHandler that makes it easier to set up a default transport, etc.

  • exports DefaultTransport

  • Exports RetryClass -> Retry in the @amplitude/types module to avoid confusion as this is an interface to implement and not a Class in itself. deprecating and still exporting RetryClass to avoid breaking changes (for now).

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?:

}

protected _getPayloadOptions(): { options?: PayloadOptions } {
if (typeof this._options.minIdLength === 'number') {
Copy link
Contributor

Choose a reason for hiding this comment

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

noob typescript question here: if _options is typed as an Options, why specifically check if minIdLength is a number? Or is this a roundabout way of making sure it's not null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

minIdLength is by default null since it's typed as null | number - if it's not defined, I think it would be better for the HTTP API to decide what the "correct" min ID length is

@jooohhn jooohhn self-requested a review March 22, 2021 22:35
Copy link
Contributor

@jooohhn jooohhn left a comment

Choose a reason for hiding this comment

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

1 nit, else LGTM 👍

@@ -2,11 +2,16 @@ import { Event } from './event';
import { Response } from './response';

/** Layer used to send data to Amplitude while retrying throttled events in the right order. */
export interface RetryClass {
export interface Retry {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes a lot of sense, ty! will change

@kelvin-lu kelvin-lu force-pushed the 273/retry-override branch from 788939b to 3a9a750 Compare March 31, 2021 00:43
@kelvin-lu kelvin-lu merged commit 9d2a977 into main Mar 31, 2021
@kelvin-lu kelvin-lu deleted the 273/retry-override branch March 31, 2021 00:51
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.

3 participants