Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Functions like get_data are inherently not thread safe

Open
#63 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
api

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PokeAPI/pokebase

All issues in PokeAPI/pokebase

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.