Skip to content

Conversation

@cirospaciari
Copy link
Member

No description provided.

@cirospaciari cirospaciari self-assigned this Feb 18, 2023
@cirospaciari cirospaciari marked this pull request as ready for review February 20, 2023 20:17
"http://localhost:64321/stream",
{
method: "POST",
body: new ReadableStream({
Copy link
Collaborator

Choose a reason for hiding this comment

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

start is executed synchronously, so this test does nothing

@Jarred-Sumner
Copy link
Collaborator

I don't think we can ship this until it also works with Bun.serve() because people will expect it to work there too

@cirospaciari
Copy link
Member Author

I don't think we can ship this until it also works with Bun.serve() because people will expect it to work there too

added

@cirospaciari cirospaciari changed the title feat(Request.signal) Initial support for signal in Request + fetch feat(Request.signal) Initial support for signal in Request + fetch and Request + Bun.serve Feb 22, 2023
void AbortSignal::cleanNativeBindings(void* ref) {
auto callbacks = std::exchange(m_native_callbacks, {});

callbacks.removeLastMatching([=](auto callback){
Copy link
Collaborator

Choose a reason for hiding this comment

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

should it be removeLastMatching or remove all matching?

Copy link
Member Author

Choose a reason for hiding this comment

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

removeAllMatching is the right answer, fixed on 483a9f8

if (request_js.as(Request)) |req| {
if (req.signal) |signal| {
// if signal is not aborted, abort the signal
if(!signal.aborted()){
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are two places we need this code in, grep for the comment above

Copy link
Member Author

Choose a reason for hiding this comment

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

I see fixed on 483a9f8

@Jarred-Sumner
Copy link
Collaborator

can you add a test to the list of ReactDOM tests which sees how that handles aborting in the middle of a ReadableStream?

after that I think one or 2 more tests with ReadableStream type: "direct" set and then we merge

req.signal.addEventListener("abort", () => {
signalOnServer = true;
});
await Bun.sleep(3000);
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we make these timeouts shorter so the test doesn't take as long, but still assert sequential order?

Copy link
Collaborator

Choose a reason for hiding this comment

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

after that i think its good to merge

@Jarred-Sumner Jarred-Sumner merged commit 24d624b into main Feb 23, 2023
@Jarred-Sumner Jarred-Sumner deleted the ciro/fetch-abort branch February 23, 2023 03:27
enisdenjo added a commit to enisdenjo/graphql-sse that referenced this pull request Mar 6, 2023
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