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

misc: Migrate MobyGamesHandler to async #1011

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

adamantike
Copy link
Collaborator

@adamantike adamantike commented Jul 22, 2024

Convert MobyGamesHandler methods to be asynchronous, and use an httpx async client, instead of requests sync client.

This change also introduces a ContextVar and the concept of a context shared between requests. The context is automatically instrumented for FastAPI requests, by using a middleware.

For processes that do not run from within requests, the @initialize_context() decorator must be used. For example, for tasks triggered from rq workers.

Copy link

github-actions bot commented Jul 22, 2024

Test Results

72 tests  ±0   72 ✅ ±0   20s ⏱️ ±0s
 1 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 7c6dfa8. ± Comparison against base commit e1cec57.

♻️ This comment has been updated with latest results.

Convert `MobyGamesHandler` methods to be asynchronous, and use an
`httpx` async client, instead of `requests` sync client.
@adamantike adamantike force-pushed the misc/migrate-moby-handler-to-async branch from 7a45282 to 6d8a871 Compare July 22, 2024 04:09
Copy link
Member

@gantoine gantoine left a comment

Choose a reason for hiding this comment

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

super clean, very nice 👌🏼

@adamantike adamantike merged commit b9da728 into master Jul 23, 2024
8 checks passed
@adamantike adamantike deleted the misc/migrate-moby-handler-to-async branch July 23, 2024 14:10
@zurdi15 zurdi15 mentioned this pull request Aug 7, 2024
spiceratops referenced this pull request in spiceratops/k8s-gitops Aug 20, 2024
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [rommapp/romm](https://togithub.com/rommapp/romm) | minor | `3.3.0` ->
`3.4.0` |

---

> [!WARNING]
> Some dependencies could not be looked up. Check the Dependency
Dashboard for more information.

---

### Release Notes

<details>
<summary>rommapp/romm (rommapp/romm)</summary>

### [`v3.4.0`](https://togithub.com/rommapp/romm/releases/tag/3.4.0)

[Compare
Source](https://togithub.com/rommapp/romm/compare/3.3.0...3.4.0)

#### What's Changed

- feat: Added link to home button by
[@&#8203;zurdi15](https://togithub.com/zurdi15) in
[https://github.com/rommapp/romm/pull/1054](https://togithub.com/rommapp/romm/pull/1054)
- feat: Public collections by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[https://github.com/rommapp/romm/pull/1028](https://togithub.com/rommapp/romm/pull/1028)
- feat: Added aditional platform icons by
[@&#8203;Casuallynoted](https://togithub.com/Casuallynoted) in
[https://github.com/rommapp/romm/pull/1038](https://togithub.com/rommapp/romm/pull/1038)
- feat: Store and re-use last saved bios/save/state/core by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[https://github.com/rommapp/romm/pull/1037](https://togithub.com/rommapp/romm/pull/1037)
- feat: Clickable filter buttons on details view by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[https://github.com/rommapp/romm/pull/1040](https://togithub.com/rommapp/romm/pull/1040)
- feat: Add button to show duplicates by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[https://github.com/rommapp/romm/pull/1043](https://togithub.com/rommapp/romm/pull/1043)
- fix: Scanning selected roms by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[https://github.com/rommapp/romm/pull/1042](https://togithub.com/rommapp/romm/pull/1042)
- fix: Use namespaced cookie for session by
[@&#8203;adamantike](https://togithub.com/adamantike) in
[https://github.com/rommapp/romm/pull/1009](https://togithub.com/rommapp/romm/pull/1009)
- fix: Replace game-and-watch with g-and-w by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[https://github.com/rommapp/romm/pull/1026](https://togithub.com/rommapp/romm/pull/1026)
- fix: Backend URL redirection logic by
[@&#8203;adamantike](https://togithub.com/adamantike) in
[https://github.com/rommapp/romm/pull/1058](https://togithub.com/rommapp/romm/pull/1058)
- fix: Enable flake8-async rules in ruff and fix warnings by
[@&#8203;adamantike](https://togithub.com/adamantike) in
[https://github.com/rommapp/romm/pull/1030](https://togithub.com/rommapp/romm/pull/1030)
- fix: Initialize context on scheduled task by
[@&#8203;adamantike](https://togithub.com/adamantike) in
[https://github.com/rommapp/romm/pull/1033](https://togithub.com/rommapp/romm/pull/1033)
- fix: Return early if IGDB finds an exact match by
[@&#8203;adamantike](https://togithub.com/adamantike) in
[https://github.com/rommapp/romm/pull/1032](https://togithub.com/rommapp/romm/pull/1032)
- fix: CSRF token issues by
[@&#8203;zurdi15](https://togithub.com/zurdi15) in
[https://github.com/rommapp/romm/pull/1057](https://togithub.com/rommapp/romm/pull/1057)
- fix: Link from related games by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[https://github.com/rommapp/romm/pull/1045](https://togithub.com/rommapp/romm/pull/1045)
- fix: Typos in frontend by
[@&#8203;HellLord77](https://togithub.com/HellLord77) in
[https://github.com/rommapp/romm/pull/1048](https://togithub.com/rommapp/romm/pull/1048)
- fix: Firmware pagination by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[https://github.com/rommapp/romm/pull/1041](https://togithub.com/rommapp/romm/pull/1041)
- fix: Multi-file download in gallery view by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[https://github.com/rommapp/romm/pull/1044](https://togithub.com/rommapp/romm/pull/1044)
- fix: Remove persistent overlay prevents back navigation by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[https://github.com/rommapp/romm/pull/1036](https://togithub.com/rommapp/romm/pull/1036)
- misc: Add Redis async cache by
[@&#8203;adamantike](https://togithub.com/adamantike) in
[https://github.com/rommapp/romm/pull/1010](https://togithub.com/rommapp/romm/pull/1010)
- misc: Create config.batocera-retrobat.yml by
[@&#8203;TyroneSlothrop](https://togithub.com/TyroneSlothrop) in
[https://github.com/rommapp/romm/pull/1013](https://togithub.com/rommapp/romm/pull/1013)
- misc: Migrate MobyGamesHandler to async by
[@&#8203;adamantike](https://togithub.com/adamantike) in
[https://github.com/rommapp/romm/pull/1011](https://togithub.com/rommapp/romm/pull/1011)
- misc: Migrate filesystem resource handler to async by
[@&#8203;adamantike](https://togithub.com/adamantike) in
[https://github.com/rommapp/romm/pull/1017](https://togithub.com/rommapp/romm/pull/1017)
- misc: Replace pytest-vcr dependency with pytest-recording by
[@&#8203;adamantike](https://togithub.com/adamantike) in
[https://github.com/rommapp/romm/pull/1021](https://togithub.com/rommapp/romm/pull/1021)
- misc: Refactor scan process by splitting single function by
[@&#8203;adamantike](https://togithub.com/adamantike) in
[https://github.com/rommapp/romm/pull/1024](https://togithub.com/rommapp/romm/pull/1024)
- misc: Migrate IGDBBaseHandler to async by
[@&#8203;adamantike](https://togithub.com/adamantike) in
[https://github.com/rommapp/romm/pull/1023](https://togithub.com/rommapp/romm/pull/1023)
- misc: Use PYTEST_VERSION variable to detect Pytest runs by
[@&#8203;adamantike](https://togithub.com/adamantike) in
[https://github.com/rommapp/romm/pull/1034](https://togithub.com/rommapp/romm/pull/1034)
- misc: Use async interface for stream-zip by
[@&#8203;adamantike](https://togithub.com/adamantike) in
[https://github.com/rommapp/romm/pull/1035](https://togithub.com/rommapp/romm/pull/1035)
- misc: Add workflow that runs typecheck on PRs by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[https://github.com/rommapp/romm/pull/1055](https://togithub.com/rommapp/romm/pull/1055)
- misc: Make backend handle URLs with trailing slash by
[@&#8203;adamantike](https://togithub.com/adamantike) in
[https://github.com/rommapp/romm/pull/1059](https://togithub.com/rommapp/romm/pull/1059)
- misc: Drop ROMM_AUTH_USERNAME and ROMM_AUTH_PASSWORD env variables by
[@&#8203;gantoine](https://togithub.com/gantoine) in
[https://github.com/rommapp/romm/pull/1060](https://togithub.com/rommapp/romm/pull/1060)

#### New Contributors

- [@&#8203;TyroneSlothrop](https://togithub.com/TyroneSlothrop) made
their first contribution in
[https://github.com/rommapp/romm/pull/1013](https://togithub.com/rommapp/romm/pull/1013)

**Full Changelog**:
rommapp/romm@3.3.0...3.4.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yMS4zIiwidXBkYXRlZEluVmVyIjoiMzguMjEuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsicmVub3ZhdGUvY29udGFpbmVyIiwidHlwZS9taW5vciJdfQ==-->
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.

2 participants