-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(replay): Change addEvent
to be async
#6695
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
Conversation
size-limit report 📦
|
db689d6
to
da00da3
Compare
packages/replay/src/types.ts
Outdated
} | ||
|
||
export type WorkerAddEventResponse = boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ehh wouldn't mind a suggestion for a better name for this type alias. Right now it's just boolean for true/false if worker succeeds in processing the event, but could change in the future (e.g. we could return the current compressed size).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO this should return an object, otherwise it is hard to extend this in the future.
But actually, I wonder if we really need this at all. If all we care about is if it has been successfully added or not, it would be more appropriate to just let it reject the promise than to resolve with true.
da00da3
to
641c08c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO instead of having a promise that resolves in true/false, I would just let the promise reject if we couldn't add the event. Then we can change the API to addEvent: Promise<void>
, which is IMHO nicer than Promise<boolean>
.
packages/replay/src/types.ts
Outdated
} | ||
|
||
export type WorkerAddEventResponse = boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO this should return an object, otherwise it is hard to extend this in the future.
But actually, I wonder if we really need this at all. If all we care about is if it has been successfully added or not, it would be more appropriate to just let it reject the promise than to resolve with true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
dec280a
to
d0a164e
Compare
7bee5e4
to
c400bb0
Compare
c400bb0
to
024c4ca
Compare
`addEvent` should be async as it waits for a response from Compression worker.
2bed985
to
97cb8ea
Compare
addEvent
should be async as it waits for a response from Compression worker. We don't necessarily always awaitaddEvent()
, but it's more correct that it is marked asasync
and can maybe save some headaches down the line.Requires #6696