Skip to content

Refactor proxycache server: thread-safety, atomic writes, and deduplication - #14

Merged
mamico merged 4 commits into
masterfrom
refactor/proxycache-server
Sep 29, 2026
Merged

mamico merged 4 commits into
masterfrom
refactor/proxycache-server

Conversation

@mamico

@mamico mamico commented Sep 29, 2026

Copy link
Copy Markdown
Member

Description

This PR refactors the RSS proxycache server () to address thread-safety, concurrency, reliability, and security issues identified during code review.

Key Improvements

  • Thread Safety & Race Conditions: Added to synchronize access to and background thread states.
  • Background Thread Deduplication: Implemented to ensure at most one background refresh thread runs per URL, preventing thread leaks.
  • Atomic Cache File Writes: Implemented using temporary files and to prevent corrupted JSON reads during concurrent client requests.
  • Non-blocking Server: Upgraded to so that slow remote feed requests do not block other clients.
  • SSRF & URL Validation: Added check to validate URL scheme and prevent basic SSRF probing against internal endpoints.
  • Docstring & Usage Preserved: Retained all original docstrings, including usage examples and notes.
  • Unit Testing: Added unit tests in covering cache path generation, atomic writing, URL validation, thread deduplication, and error handling.
  • Changelog: Updated .

@coveralls

coveralls commented Sep 29, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 36587920022

Warning

No base build found for commit 15879b0 on master.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 70.968%

Details

  • Patch coverage: 62 uncovered changes across 2 files (50 of 112 lines covered, 44.64%).

Uncovered Changes

File Changed Covered %
src/redturtle/rssservice/proxycacheserver/main.py 107 46 42.99%
src/redturtle/rssservice/rss_mixer.py 4 3 75.0%
Total (3 files) 112 50 44.64%

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 434
Covered Lines: 308
Line Coverage: 70.97%
Coverage Strength: 2.12 hits per line

💛 - Coveralls

@mamico
mamico merged commit eee1fae into master Sep 29, 2026
11 checks passed
@mamico
mamico deleted the refactor/proxycache-server branch September 29, 2026 15:57
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