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

feature: Add support for immediate flag when using Kinesis analytics providers #10783

Merged
merged 5 commits into from Dec 16, 2022

Conversation

jimblanc
Copy link
Contributor

@jimblanc jimblanc commented Dec 16, 2022

Description of changes

This change adds support for the immediate flag when using AWSKinesisProvider or AWSKinesisFirehouseProvider to align with our published API contract. Setting the immediate flag on a record will trigger the providers to immediately send the record to the appropriate Kinesis client without trying to buffer it. The motivations for this change were to align the API with Pinpoint client & help a customer who was having trouble emitted Kinesis events from a RN application while in the background (due to RN pausing timers, such as the one used to flush the event buffer).

Issue #, if available

SIM Issue

Description of how you validated changes

Local testing, clean integration test run. Verified that immediate records were persisted in the Kinesis data stream in a React Native application from both the foreground and background (see attached image).

Screen Shot 2022-12-16 at 9 00 32 AM

Checklist

  • PR description included
  • yarn test passes
  • Tests are added
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jimblanc jimblanc marked this pull request as ready for review December 16, 2022 17:59
@jimblanc jimblanc requested a review from a team as a code owner December 16, 2022 17:59
if (params.event?.immediate) {
this._sendEvents([params]);

return Promise.resolve(true);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This matches the behavior of this._putToBuffer

Copy link
Contributor

@AllanZhengYP AllanZhengYP left a comment

Choose a reason for hiding this comment

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

It looks good to me. Is there any documentation update required?

@jimblanc
Copy link
Contributor Author

It looks good to me. Is there any documentation update required?

Yep there was a 1 line change required, working on it now.

@codecov-commenter
Copy link

Codecov Report

Merging #10783 (1967c8d) into main (8f6dd70) will increase coverage by 0.50%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main   #10783      +/-   ##
==========================================
+ Coverage   85.65%   86.15%   +0.50%     
==========================================
  Files         196      197       +1     
  Lines       18261    18379     +118     
  Branches     3892     3911      +19     
==========================================
+ Hits        15642    15835     +193     
+ Misses       2543     2470      -73     
+ Partials       76       74       -2     
Impacted Files Coverage Δ
packages/amazon-cognito-identity-js/src/Client.js 50.48% <0.00%> (-1.52%) ⬇️
packages/datastore/__tests__/commonAdapterTests.ts 98.16% <0.00%> (-0.17%) ⬇️
...ages/amazon-cognito-identity-js/src/CognitoUser.js 79.06% <0.00%> (-0.12%) ⬇️
packages/core/src/Util/CognitoIdentityClient.ts 100.00% <0.00%> (ø)
packages/datastore/src/datastore/datastore.ts 88.38% <0.00%> (+0.04%) ⬆️
packages/datastore/__tests__/helpers.ts 84.24% <0.00%> (+0.10%) ⬆️
packages/auth/src/Auth.ts 87.38% <0.00%> (+0.24%) ⬆️
...ages/analytics/src/Providers/AWSKinesisProvider.ts 84.25% <0.00%> (+0.38%) ⬆️
packages/datastore/src/storage/relationship.ts 93.67% <0.00%> (+1.26%) ⬆️
packages/core/src/Credentials.ts 67.70% <0.00%> (+28.41%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@elorzafe elorzafe left a comment

Choose a reason for hiding this comment

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

Looks good to me

Thanks @jimblanc 🔥

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.

None yet

4 participants