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: Correctly limit Buffer requests #3736

Merged
merged 3 commits into from
Jun 23, 2021
Merged

Conversation

kamilogorek
Copy link
Contributor

I'd prefer to have add(taskProducer: TaskProducer<T>): PromiseLike<T> signature, but the problem is that we might break custom transports that use Buffer implementation. Not even sure if there are any in the wild, so it might be worth playing it not safe and just go for a valid implementation already? fwiw the current implementation is basically broken, so I think it's better to implement it correctly and actually force people to update their custom transports if they have any.

For reviewers: You can skip all transport/file.ts changes. They only add () => before each new Promise, but indentations make it look like a lot of changes (noting this as not everyone is using hide whitespace changes in GitHub UI).

Fixes #3725

@kamilogorek kamilogorek requested review from a team, ahmedetefy and vladanpaunovic and removed request for a team June 23, 2021 10:50
@kamilogorek kamilogorek force-pushed the fix-transport-buffer-limiting branch from 4c3b54b to 8d36cce Compare June 23, 2021 10:51
@github-actions
Copy link
Contributor

github-actions bot commented Jun 23, 2021

size-limit report

Path Size
@sentry/browser - CDN Bundle (gzipped) 21.01 KB (-0.01% 🔽)
@sentry/browser - Webpack 21.95 KB (0%)
@sentry/react - Webpack 21.99 KB (0%)
@sentry/browser + @sentry/tracing - CDN Bundle (gzipped) 28.42 KB (-0.01% 🔽)

Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

Code is fine, would like to see some extra detail in doc strings to make sure we don’t lose this context.

* @returns The original promise.
*/
public add(task: PromiseLike<T>): PromiseLike<T> {
public add(taskProducer: PromiseLike<T> | TaskProducer<T>): PromiseLike<T> {
// NOTE: This is necessary to preserve backwards compatibility
Copy link
Member

Choose a reason for hiding this comment

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

Let’s add a TODO v7 note?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its implemented correctly in v7-dev branch already :)

packages/utils/src/promisebuffer.ts Outdated Show resolved Hide resolved
packages/utils/src/promisebuffer.ts Outdated Show resolved Hide resolved
Co-authored-by: Abhijeet Prasad <aprasad@sentry.io>
@kamilogorek kamilogorek merged commit 8161005 into master Jun 23, 2021
@kamilogorek kamilogorek deleted the fix-transport-buffer-limiting branch June 23, 2021 11:29
1999 added a commit to 1999/sentry-javascript that referenced this pull request Jun 25, 2021
…transport

* upstream/master: (29 commits)
  ref: Always use lowercase files (getsentry#3742)
  feat: Make dedupe integration default for browser (getsentry#3730)
  ref(ember): Allow initing Ember without config entry (getsentry#3745)
  fix(serverless): wrapEventFunction does not await for async code (getsentry#3740)
  Metrics: Tag CLS elements (getsentry#3734)
  feat: Add Next.js 11 to supported peer dependencies list (getsentry#3711)
  test: Run integration tests for Next 10/11 and Webpack 4/5 matrix (getsentry#3741)
  fix: Correctly limit Buffer requests (getsentry#3736)
  Whoops. Remove pinned node version from package.json
  ref: Introduce test runner for node session health tests (getsentry#3728)
  fix: Prevent circular structure serialization in events (getsentry#3727)
  ref(node): Update Node manual tests and test for sessionCount (getsentry#3726)
  ref(ember): Update scenarios and remove a few to speed up tests (getsentry#3720)
  docs: Fix typos (getsentry#3716)
  fix(ember): Fix ember test flake (getsentry#3719)
  release: 6.7.2
  ci: fix ember flaky test (getsentry#3718)
  misc: changelog for release 6.7.2 (getsentry#3717)
  fix(release-health): Prevent sending terminal status session updates (getsentry#3701)
  ref: Make beforeSend more strict (getsentry#3713)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants