uNetworking / uWebSockets.js

μWebSockets for Node.js back-ends :metal:
Apache License 2.0
7.65k stars 560 forks source link

Aborted called on a running task #1057

Closed RJ4100 closed 1 month ago

RJ4100 commented 2 months ago

Is there a way to prevent aborted being called for a specific call? I want to wait until the function completes. I see this example: if (!res.aborted) { res.cork(() => { res.end(r); }); }

However, I need a way to respond to the user when the res is done or aborted. I see the request aborts in 3 seconds. I'm looking to increase timeout to like 4 seconds.

uNetworkingAB commented 1 month ago

prevent aborted being called

If the peer disconnects, which can happen at any time, you technically have no way to respond. You can't prevent this.

uNetworkingAB commented 1 month ago

"Aborted called on a running task" <- this caption is good. I understand what you mean. But there is no technical way to prevent this, you need to either let your running task complete and then discard it if aborted, or support prematurely breaking the running task. Either solution will work.