Functions like get_data are inherently not thread safe
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 30/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 361
- Fork
- 58
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PokeAPI/pokebase
-
Status updateĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Strange syntaxing errorĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Tất cả issue của PokeAPI/pokebase
Issue tương tự
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
vllm-project/vllm-metal#822 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
vector-store
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 90/100
mem0ai/mem0#7461 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: chunk_span_bounds and _validated_chunk_spans reject Pydantic models ChunkSpan and AudioFileĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
BasedHardware/omi#19047 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày