Skip to content

Conversation

@ggamnunq
Copy link
Contributor

@ggamnunq ggamnunq commented Sep 8, 2025

혼잡도 일관성 보장

  • PlaceRedisUtil.getRedisCongestion() 메서드 사용 중지
  • PlaceRedisUtil.getTimeCongestion() 메서드로 혼잡도 정보 조회 통일
  • 모든 api에서 getTimeCongestion() 메서드로 일관된 혼잡도 정보 조회할 수 있도록 일부 수정
    • getTimeCongestion()메서드 호출 시, placeId만으로도 호출할 수 있도록 메서드 추가

Summary by CodeRabbit

  • New Features
    • Time-based congestion levels now power all place views, refreshing in 3‑hour windows for more current insights.
  • Improvements
    • Consistent congestion display across Home, Place Lists, Maps, Details, Search, and Recommendations.
    • Better handling when data is unavailable, reducing empty or misleading values.
  • Bug Fixes
    • Resolved inconsistencies where congestion values differed between screens.
  • Performance
    • Faster, smoother loading of congestion data due to smarter caching.

@ggamnunq ggamnunq self-assigned this Sep 8, 2025
@coderabbitai
Copy link

coderabbitai bot commented Sep 8, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Updated congestion retrieval across services to use a new time-bucketed API (getTimeCongestion) returning Float, replacing getRedisCongestion. Call sites now convert to Int when populating DTOs. PlaceRedisUtil implements time-based keys with 3-hour buckets, TTL, and lazy initialization via setIfAbsent; prior method removed.

Changes

Cohort / File(s) Summary of Changes
Time-based congestion utility
src/main/kotlin/busanVibe/busan/domain/place/util/PlaceRedisUtil.kt
Replaced getRedisCongestion with getTimeCongestion (overloads). Implemented 3-hour bucketed, date-scoped Redis keys with 24h TTL, lazy set via setIfAbsent, returning Float. Made setPlaceTimeCongestion private and nullable placeId.
Service and util callers update
.../domain/home/service/HomeQueryService.kt, .../domain/place/converter/PlaceDetailsConverter.kt, .../domain/place/service/PlaceCongestionQueryService.kt, .../domain/place/service/PlaceQueryService.kt, .../domain/search/util/SearchUtil.kt
Replaced getRedisCongestion(...) calls with getTimeCongestion(...) and cast to Int for DTO fields (e.g., congestionLevel). No control-flow changes; null-checks preserved.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Svc as Service/Converter/Search
  participant Util as PlaceRedisUtil
  participant R as Redis

  Svc->>Util: getTimeCongestion(placeId[, dateTime])
  Util->>Util: Compute 3-hour bucketed key<br/>place:congestion:<id>-YYYY-M-D-HHbucket
  Util->>R: GET key
  alt Cache hit
    R-->>Util: value (Float as String)
    Util-->>Svc: Float
  else Cache miss
    Util->>Util: Generate congestion value
    Util->>R: SETNX key value EX 86400
    R-->>Util: OK/Already exists
    Util->>R: GET key
    R-->>Util: value
    Util-->>Svc: Float
  end
  note over Svc: Call sites convert to Int via toInt() when needed
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

Thump-thump go my paws on keys,
Time slices breeze like coastal seas.
From buckets three, the numbers climb,
Redis remembers, just in time.
I nibble bytes, convert to int—
Congestion mapped, a perfect hint.
Hop on—our data’s fresh and mint! 🐇📊


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5073382 and f433c2c.

📒 Files selected for processing (6)
  • src/main/kotlin/busanVibe/busan/domain/home/service/HomeQueryService.kt (3 hunks)
  • src/main/kotlin/busanVibe/busan/domain/place/converter/PlaceDetailsConverter.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/place/service/PlaceCongestionQueryService.kt (2 hunks)
  • src/main/kotlin/busanVibe/busan/domain/place/service/PlaceQueryService.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/place/util/PlaceRedisUtil.kt (1 hunks)
  • src/main/kotlin/busanVibe/busan/domain/search/util/SearchUtil.kt (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ggamnunq ggamnunq merged commit d0aa1a8 into main Sep 8, 2025
1 of 2 checks passed
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