7a12f0e9c8f377c49dfbf391926685d0ab196280
Deploy Scraper / build-and-deploy (push) Canceled after 0s
The scraper cached a single RedisCache (one multiplexed connection) in a OnceCell forever. When that one connection broke (Redis restart, idle timeout, network blip), every cache op failed with 'cache io: broken pipe', and because Cache::get_or_set propagated the post-compute write error, EVERY API (anime, anime2, komik) returned 500 until a process restart. Fix: - Build a fresh RedisCache from a freshly checked-out deadpool connection per call, so a broken connection self-heals without a process restart (deadpool recycles/drops dead connections and reconnects on checkout). - Make Cache::get_or_set treat a cache-write failure as non-fatal: return the freshly computed value (cache is best-effort), so a transient Redis outage degrades to cache-less instead of 500. Pre-existing clippy warnings (repositories/parsers) untouched — out of scope.
Scraper API
Backend service berbasis Axum untuk scraping, image proxy/cache, dan endpoint API inti.
Stack
- Rust + Axum
- SeaORM (MySQL)
- Redis (deadpool-redis)
- Utoipa + Swagger UI
Quick Start
cargo run
Server bind ke 0.0.0.0:${PORT} dengan default port 4091.
Required Environment Variables
DATABASE_URL=mysql://asephs:hunterz@localhost:3306/sosmed
JWT_SECRET=change-me
REDIS_URL=redis://localhost:6379
Optional yang sering dipakai:
RUST_LOG=info
MINIO_ENDPOINT=
MINIO_BUCKET_NAME=
MINIO_ACCESS_KEY=
MINIO_SECRET_KEY=
Useful Endpoints
GET /docs- Swagger UIGET /api-docs/openapi.json- OpenAPI JSONGET /api/anime2/*GET /api/komik/*POST /api/proxy/image-cachePOST /api/proxy/image-cache/audit
Notes
- Database akan dicek/dibuat saat startup jika
DATABASE_URLbertipe MySQL. - Service ini juga menginisialisasi browser pool dan scheduler saat boot.
License
MIT
Languages
Rust
97.1%
Python
1.9%
Shell
0.6%
Nix
0.3%
JavaScript
0.1%