Functions like get_data are inherently not thread safe
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
Research direction
Start by reading the implementations of get_data and save, then examine how shelve is used during concurrent operations. Define and test the proposed option to disable automatic disk saving and provide a manual save step; done means concurrent use avoids unprotected persistence and the final state can be saved consistently.
Written by the indexing model from the issue text.
Description
The current implementation of get_data directly calls save, which introduces a risk when used in multithreaded contexts. The disk I/O performed by save is not protected, but locking around it has serious performance implications.
In my own private implementation of a REST API client for PokeAPI in python (sorry just found out about this project), I solved this by separating in‑memory caching from disk persistence. My approach was:
- Keep an in‑memory cache updated freely across threads.
- Disable automatic disk saving during concurrent operations.
- Manually invoke a disk save step once threads have finished, ensuring serialization and consistency.
One note is it would likely involve not using shelve as I believe that is not thread safe. But other features may be more suited.
With approval, I am willing to begin migrating my code to use pokebase, implement and test a option to disable auto‑save and give manual control.
- Dominant language
- Python
- Stars
- 361
- Forks
- 58
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PokeAPI/pokebase
-
Status update Open
Difficulty 5/5 Over a week Newbie friendliness 20/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
All issues in PokeAPI/pokebase
Similar issues
-
agent-ready documentation needs-triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
instance instance add
Difficulty 1/5 Under an hour Newbie friendliness 72/100
searxng/searx-instances#939 · 1 comment ·
-
area-deployment area-integrations triage:bot-seen
Difficulty 2/5 Half a day Newbie friendliness 86/100