Skip to content
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

⚡️ Performance: Parallelize API calls when possible #149

Closed
3 tasks done
JoshuaKGoldberg opened this issue Apr 10, 2023 · 1 comment · Fixed by #170
Closed
3 tasks done

⚡️ Performance: Parallelize API calls when possible #149

JoshuaKGoldberg opened this issue Apr 10, 2023 · 1 comment · Fixed by #170
Assignees
Labels
status: accepting prs Please, send a pull request to resolve this! type: feature New enhancement or request

Comments

@JoshuaKGoldberg
Copy link
Owner

Feature Request Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Overview

Poking through src/content-script.ts, I think I spy a couple API requests that are made in series now but could be made in parallel:

Those two API calls don't rely on data from each other. So 3 doesn't have to wait on 2. We could await Promise.all them or similar. Let's do that for a little performance boost! ⚡

Additional Info

Marking as blocked on #5 just in case that PR refactors a bunch of things.

@JoshuaKGoldberg JoshuaKGoldberg added type: feature New enhancement or request status: blocked Waiting for something else to be resolved labels Apr 10, 2023
@JoshuaKGoldberg JoshuaKGoldberg changed the title ⚡️ Performance: Parallelize ⚡️ Performance: Parallelize API calls when possible Apr 10, 2023
@JoshuaKGoldberg
Copy link
Owner Author

Ehh, I'll just tackle this myself now 😄

@JoshuaKGoldberg JoshuaKGoldberg added status: accepting prs Please, send a pull request to resolve this! and removed status: blocked Waiting for something else to be resolved labels Nov 14, 2023
@JoshuaKGoldberg JoshuaKGoldberg self-assigned this Nov 14, 2023
JoshuaKGoldberg added a commit that referenced this issue Nov 14, 2023
## PR Checklist

- [x] Addresses an existing open issue: fixes #149
- [x] That issue was marked as [`status: accepting
prs`](https://github.com/JoshuaKGoldberg/refined-saved-replies/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22)
- [x] Steps in
[CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/refined-saved-replies/blob/main/.github/CONTRIBUTING.md)
were taken

## Overview

Uses `Promise.all` and a new `fetchAsJson` helper to clean up the code a
bit and run the two requests in parallel, rather than in series.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Please, send a pull request to resolve this! type: feature New enhancement or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant