refactor: migrate infra to mytheclipse crates (retry, cache, event, ratelimit, config)
Deploy Scraper / build-and-deploy (push) Canceled after 0s

Replace hand-rolled infrastructure with the custom mytheclipse library:

- retry (src/infrastructure/scraping/retry.rs): backoff crate -> mytheclipse
  RetryConfig + retry() with retry_all predicate; same call-site helpers.
- cache (src/infrastructure/cache): deadpool raw AsyncCommands ->
  mytheclipse_cache::RedisCache bridge (src/infrastructure/cache/mytheclipse.rs),
  typed JSON wrapper keeps the Cache<'a> API used by use cases.
- events (src/events/bus.rs): custom broadcast pub/sub ->
  mytheclipse_event InMemoryEventBus + TypedEventBus alias.
- ratelimit (src/presentation/middleware/ratelimit.rs): hand-rolled window ->
  mytheclipse::RateLimiter token bucket.
- config (src/config/mod.rs): config crate -> mytheclipse_config ConfigLoader,
  preserving env-only fallback (config files optional).

No route/API/Redis-key changes. mytheclipse-cache path-dep points at local
source (redis 0.32 aligned with deadpool). Removed backoff/config deps.
This commit is contained in:
asepharyana
2026-08-30 18:53:00 +07:00
parent 6ebff90d5b
commit c7ffd29e79
14 changed files with 703 additions and 564 deletions
+5 -2
View File
@@ -13,6 +13,11 @@ default-run = "scraper"
# Dependensi yang dibutuhkan saat aplikasi berjalan
[dependencies]
mytheclipse = { version = "1.20", features = ["resiliency", "traffic"] }
mytheclipse-cache = { path = "/home/code/mytheclipse/crates/mytheclipse-cache", features = ["l2-redis", "cache-aside"] }
mytheclipse-config = { version = "1.20" }
mytheclipse-event = { version = "1.20" }
axum = { version = "0.8.8", features = ["ws", "multipart", "macros"] }
tokio = { version = "1.49.0", features = ["full"] }
serde = { version = "1.0", features = ["derive"] }
@@ -36,7 +41,6 @@ urlencoding = "2.1"
url = "2.5.8"
tower-http = { version = "0.6.8", features = ["fs", "cors", "compression-gzip", "compression-br", "compression-zstd"] }
backoff = { version = "0.4", features = ["futures", "tokio"] }
dashmap = "6.1"
deadpool-redis = { version = "0.22.1", features = ["serde"] }
rayon = "1.11"
@@ -44,7 +48,6 @@ scraper = "0.25.0"
flate2 = "1.1"
redis = { version = "0.32.7", features = ["tokio-rustls-comp", "safe_iterators"] }
thiserror = "2.0.18"
config = { version = "0.15.19", features = ["toml"] }
utoipa = { version = "5.0", features = ["axum_extras"] }
utoipa-swagger-ui = { version = "9.0", features = ["axum"] }