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: Rely on on task completion vs http completion to end tasks #134

Merged
merged 2 commits into from
Mar 15, 2024

Conversation

crleona
Copy link
Collaborator

@crleona crleona commented Mar 14, 2024

Summary

EventPipeline previously cleared out tasks based on whether the http request was still in progress, not whether the request had fully completed and we had cleaned up the previous eventBlock. This means that a flush that was called after all requests had completed but before they were processed would re-upload previously uploaded events, as their backing files still exists.

Now, we track upload tasks more granularly by eventBlock URL, and clear them only when processing is complete, which guarantees that an eventBlock is only uploaded once (per amplitude instance, at least).

There is a change in behavior of how we upload with this change: instead of waiting for all requests to complete before starting a new batch, we will immediately start to upload any new eventBlocks on every flush, regardless of how many requests are already in progress. I think this would be the more expected behavior, but it should also be pretty easy to change back.

Checklist

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

@crleona crleona force-pushed the AMP-94497-fix-task-handling branch from 60f5643 to d4a65e1 Compare March 14, 2024 18:16
Copy link
Contributor

@justin-fiedler justin-fiedler left a comment

Choose a reason for hiding this comment

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

Awesome. Changes look good. Thank you @crleona

I reset my review to wait for tests.

@justin-fiedler justin-fiedler self-requested a review March 14, 2024 20:03
@crleona crleona force-pushed the AMP-94497-fix-task-handling branch 4 times, most recently from c387cc3 to 32f6921 Compare March 14, 2024 23:47
@crleona
Copy link
Collaborator Author

crleona commented Mar 15, 2024

@justin-fiedler @izaaz tests added, please take a look.

@crleona crleona force-pushed the AMP-94497-fix-task-handling branch from 32f6921 to 2cb9c97 Compare March 15, 2024 18:10
@crleona crleona merged commit b17e704 into main Mar 15, 2024
3 checks passed
@crleona crleona deleted the AMP-94497-fix-task-handling branch March 15, 2024 18:43
github-actions bot pushed a commit that referenced this pull request Mar 19, 2024
## [1.4.1](v1.4.0...v1.4.1) (2024-03-19)

### Bug Fixes

* Rely on on task completion vs http completion to end tasks ([#134](#134)) ([b17e704](b17e704))
Copy link

🎉 This PR is included in version 1.4.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants