useful-forks / useful-forks.github.io

Improving GitHub's Forks list discoverability through automatic filtering. The project offers an online tool and a Chrome extension.
https://useful-forks.github.io/
MIT License
1.19k stars 61 forks source link

Allow users to manually abort #16

Open payne911 opened 3 years ago

payne911 commented 3 years ago

Potentially:

A proposed implementation was made there: https://github.com/useful-forks/useful-forks.github.io/issues/7#issuecomment-787044619

payne911 commented 3 years ago

Aborting all ongoing Promises isn't as trivial as I thought. There is a partial solution, but I'm still waiting on something that fulfills the 3 constraints listed there: https://stackoverflow.com/q/67086017/9768291

micalevisk commented 2 years ago

what about using AbortController? See https://github.com/octokit/rest.js/blob/2c7bf0c4c1121e03dae135768f20b983f1015b78/docs/src/pages/api/03_request_formats.md

payne911 commented 2 years ago

@micalevisk

Say I have 100 calls to make, and that after 70 I realize I need to stop. From what I understand, the AbortController indeed helps with avoiding the necessity to await the 70 calls to receive a response. But would it help with making sure that the following 30 requests that were supposed to be issued would get cancelled before being executed?

micalevisk commented 2 years ago

I didn't used AbortController API yet. But I guess each call could have its own abort signal, so you can invoke those controllers as you wish as long you track them properly