Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Functions like get_data are inherently not thread safe

Abierto
#63 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
30/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
python
Área
api

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
361
Forks
58
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PokeAPI/pokebase

Todos los issues de PokeAPI/pokebase

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.