useful-forks.github.io icon indicating copy to clipboard operation
useful-forks.github.io copied to clipboard

Allow users to manually abort

Open payne911 opened this issue 3 years ago • 4 comments

Potentially:

  • When reaching 80% of the remaining Rate Limited calls
  • Turn the "loading" button red and if clicked: abort

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

payne911 avatar Mar 01 '21 06:03 payne911

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

payne911 avatar Apr 18 '21 01:04 payne911

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

micalevisk avatar Feb 06 '22 01:02 micalevisk

@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?

payne911 avatar Feb 08 '22 03:02 payne911

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

micalevisk avatar Feb 08 '22 03:02 micalevisk

30 requests that were supposed to be issued would get cancelled before being executed?

Yes. You just pass the signal to fetch and when the call is made, it be immediately fail because the signal was already given.

fregante avatar May 24 '22 13:05 fregante