Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

๐Ÿ”€ :: [#557] - Redis ๊ด€๋ จ ์„ค์ •์„ ํ•˜๋‚˜์˜ ๊ฐ์ฒด์—์„œ ๊ด€๋ฆฌํ•˜๋„๋ก ์ˆ˜์ • #558

Merged
merged 4 commits into from
Mar 17, 2025

Conversation

dolong2
Copy link
Owner

@dolong2 dolong2 commented Mar 17, 2025

๊ฐœ์š”

  • Redis ๊ด€๋ จ ์„ค์ •์„ ํ•˜๋‚˜์˜ ๊ฐ์ฒด์—์„œ ๊ด€๋ฆฌํ•˜๋„๋ก ์ˆ˜์ •ํ•ฉ๋‹ˆ๋‹ค.

์ž‘์—…๋‚ด์šฉ

  • RedissonConfig ์ œ๊ฑฐ
  • RedisConfig์—์„œ RedissonClient๋ฅผ ๋นˆ์œผ๋กœ ๋“ฑ๋กํ•˜๋„๋ก ์ˆ˜์ •
  • Lock ํš๋“ ์‹คํŒจ์‹œ ๋กœ๊น… ๋ฌธ๊ตฌ ์ˆ˜์ •
  • Lock ํš๋“ ์‹คํŒจ์‹œ error ๋ ˆ๋ฒจ๋กœ ๋กœ๊น…ํ•˜๋„๋ก ์ˆ˜์ •

์ฒดํฌ๋ฆฌ์ŠคํŠธ

ํƒฌํ”Œ๋ฆฟ์™ธ์— ํ•„์š”ํ•œ ํ•ญ๋ชฉ์ด ์žˆ์œผ๋ฉด ์ถ”๊ฐ€ํ•ด์ฃผ์„ธ์š”.

  • ๋กœ์ปฌ์—์„œ ๋นŒ๋“œ๊ฐ€ ์„ฑ๊ณตํ•˜๋‚˜์š”?
  • ์ถ”๊ฐ€(์ˆ˜์ •)ํ•œ ์ฝ”๋“œ๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ๋™์ž‘ํ•˜๋‚˜์š”?
  • pr ํƒ€์ผ“ ๋ธŒ๋žœ์น˜๊ฐ€ ๋งž๊ฒŒ ์„ค์ •๋˜์–ด ์žˆ๋‚˜์š”?
  • pr์—์„œ ์ž‘์—…ํ•  ๋‚ด์šฉ์™ธ์— ์ž‘์—…ํ•œ ๋‚ด์šฉ์ด ์žˆ๋‚˜์š”?
  • ๊ธฐ์กด API์™€ ํ˜ธํ™˜๋˜์ง€ ์•Š๋Š” ์‚ฌํ•ญ์ด ์žˆ๋‚˜์š”?

Summary by CodeRabbit

  • ๋ฒ„๊ทธ ์ˆ˜์ •
    • ์ž ๊ธˆ ์‹คํŒจ ์‹œ ๋กœ๊ทธ๊ฐ€ ์˜ค๋ฅ˜ ๋ ˆ๋ฒจ๋กœ ๊ธฐ๋ก๋˜์–ด ๋ฌธ์ œ ์ธ์‹์ด ๋” ์šฉ์ดํ•ด์กŒ์Šต๋‹ˆ๋‹ค.
  • ์‹ ๊ทœ ๊ธฐ๋Šฅ
    • Redis ์—ฐ๊ฒฐ ์„ค์ •์ด ๊ฐœ์„ ๋˜์–ด ๋ณด๋‹ค ์•ˆ์ •์ ์ธ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ ‘๊ทผ์ด ๊ฐ€๋Šฅํ•ด์กŒ์Šต๋‹ˆ๋‹ค.
  • ๋ฆฌํŒฉํ† ๋ง
    • ์ค‘๋ณต๋œ Redis ๊ตฌ์„ฑ ์š”์†Œ๊ฐ€ ์ œ๊ฑฐ๋˜์–ด ์‹œ์Šคํ…œ ๊ตฌ์„ฑ์ด ๋‹จ์ˆœํ™”๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

@dolong2 dolong2 added 3๏ธโƒฃ Priority: ํ•˜ ์šฐ์„ ์ˆœ์œ„ ํ•˜ ๐Ÿ”จ Refactor ์ฝ”๋“œ ๋ฆฌํŒฉํ† ๋ง labels Mar 17, 2025
@dolong2 dolong2 self-assigned this Mar 17, 2025
Copy link
Contributor

coderabbitai bot commented Mar 17, 2025

Walkthrough

์ด๋ฒˆ PR์€ ์„ธ ๊ฐ€์ง€ ์ฃผ์š” ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ํฌํ•จํ•ฉ๋‹ˆ๋‹ค. LockAspect ํด๋ž˜์Šค์˜ redissonLock ๋ฉ”์„œ๋“œ์—์„œ๋Š” ์ž ๊ธˆ ํš๋“ ์‹คํŒจ ์‹œ ๊ธฐ๋ก๋˜๋Š” ๋กœ๊ทธ ๋ ˆ๋ฒจ์„ ๋””๋ฒ„๊ทธ์—์„œ ์—๋Ÿฌ๋กœ ๋ณ€๊ฒฝํ•˜์˜€์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ, ๊ธฐ์กด Redis ์„ค์ • ๋ถ„์‚ฐ์„ ๊ฐœ์„ ํ•˜๊ธฐ ์œ„ํ•ด RedisConfig ํด๋ž˜์Šค์— redissonClient() Bean ๋ฉ”์„œ๋“œ๊ฐ€ ์ถ”๊ฐ€๋˜์—ˆ์œผ๋ฉฐ, ๋™์ผํ•œ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋˜ RedissonConfig ํด๋ž˜์Šค๋Š” ์‚ญ์ œ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

Changes

ํŒŒ์ผ ๋ณ€๊ฒฝ ์š”์•ฝ
src/.../aop/LockAspect.kt redissonLock ๋ฉ”์„œ๋“œ ๋‚ด ๋กœ๊ทธ ๋ ˆ๋ฒจ์„ debug์—์„œ error๋กœ ์ˆ˜์ •ํ•˜์—ฌ, ์‹คํŒจํ•œ ์ž ๊ธˆ ํš๋“ ์ƒํ™ฉ์„ ์—๋Ÿฌ๋กœ ๊ธฐ๋กํ•˜๋„๋ก ๋ณ€๊ฒฝ
src/.../global/config/RedisConfig.kt
src/.../global/config/RedissonConfig.kt
Redis ์„ค์ • ํ†ตํ•ฉ: RedisConfig์— redissonClient() ๋ฉ”์„œ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜์—ฌ RedissonClient ์ธ์Šคํ„ด์Šค๋ฅผ ์ƒ์„ฑํ•˜๊ณ , ๊ธฐ์กด RedissonConfig ํด๋ž˜์Šค๋ฅผ ์‚ญ์ œ

Sequence Diagram(s)

sequenceDiagram
    participant Client as ํด๋ผ์ด์–ธํŠธ ์ฝ”๋“œ
    participant LockAspect as LockAspect
    participant Logger as ๋กœ๊น… ์‹œ์Šคํ…œ
    Client->>LockAspect: redissonLock ํ˜ธ์ถœ
    alt ์ž ๊ธˆ ํš๋“ ์„ฑ๊ณต
        LockAspect-->>Client: ์ฒ˜๋ฆฌ ์ง„ํ–‰
    else ์ž ๊ธˆ ํš๋“ ์‹คํŒจ
        LockAspect->>Logger: ์—๋Ÿฌ ๋กœ๊ทธ ๊ธฐ๋ก("Lock ํš๋“ ์‹คํŒจ: lockKey")
        LockAspect-->>Client: ์‹คํŒจ ์ฒ˜๋ฆฌ ๋ฐ˜ํ™˜
    end
Loading
sequenceDiagram
    participant App as Spring ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜
    participant RedisConfig as RedisConfig Bean ๋ฉ”์„œ๋“œ
    participant Redisson as Redisson.create(config)
    App->>RedisConfig: redissonClient() ํ˜ธ์ถœ
    RedisConfig->>Redisson: Config ๊ฐ์ฒด๋ฅผ ์‚ฌ์šฉํ•ด RedissonClient ์ƒ์„ฑ
    Redisson-->>RedisConfig: ์ธ์Šคํ„ด์Šค ๋ฐ˜ํ™˜
    RedisConfig-->>App: ์ƒ์„ฑ๋œ RedissonClient ๋ฐ˜ํ™˜
Loading

Possibly related PRs

  • ๐Ÿ”€ :: [#555] - ๋ถ„์‚ฐ๋ฝ ์ ์šฉย #556: LockAspect ํด๋ž˜์Šค์˜ ์ž ๊ธˆ ํš๋“ ๋กœ๊น… ๋ณ€๊ฒฝ๊ณผ ๊ด€๋ จ๋˜์–ด, ๋™์ผํ•œ ๋ถ„์‚ฐ ์ž ๊ธˆ ๊ด€๋ฆฌ ๊ธฐ๋Šฅ์— ๋Œ€ํ•œ ์ˆ˜์ •์ด ์ด๋ฃจ์–ด์ง„ PR์ž…๋‹ˆ๋‹ค.

Suggested labels

:memo: Doc

Poem

๋‚˜๋Š” ๊นก์ด๊นก์ด ํ† ๋ผ์˜ˆ์š”, ์ฝ”๋“œ ์ˆฒ ์†์„ ๋ˆ„๋น„๋ฉฐ
๋กœ๊ทธ๊ฐ€ ์—๋Ÿฌ๋กœ ๋ฐ˜์ง, ๋ฌธ์ œ๋ฅผ ์•Œ๋ฆฌ๋Š” ๋น›์ด ๋˜์—ˆ๋„ค ๐Ÿ‡
Redis ์„ค์ • ๊ธธ๋„ ํ†ตํ•ฉ๋˜์–ด, ์ฝ”๋“œ๊ฐ€ ๋” ๊น”๋”ํ•ด์กŒ์ฃ 
๋‚ก์€ ์„ค์ •๋“ค์€ ์‚ฌ๋ผ์ง€๊ณ , ์ƒˆ ๋ด„์„ ๋งž์ดํ•˜๋„ค์š” ๐ŸŒฑ
ํ† ๋ผ ๋ฐœ์ž๊ตญ ๋‚จ๊ธฐ๋ฉฐ, ์ฆ๊ฑฐ์šด ๋ณ€ํ™”์˜ ๋…ธ๋ž˜๋ฅผ ๋ถ€๋ฆ…๋‹ˆ๋‹ค!
๐Ÿฅ•โœจ Happy coding!

Tip

โšก๐Ÿงช Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

๐Ÿ“œ 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 1cf6f24 and f4d8ad5.

๐Ÿ“’ Files selected for processing (3)
  • src/main/kotlin/com/dcd/server/core/common/aop/LockAspect.kt (1 hunks)
  • src/main/kotlin/com/dcd/server/infrastructure/global/config/RedisConfig.kt (2 hunks)
  • src/main/kotlin/com/dcd/server/infrastructure/global/config/RedissonConfig.kt (0 hunks)
๐Ÿ’ค Files with no reviewable changes (1)
  • src/main/kotlin/com/dcd/server/infrastructure/global/config/RedissonConfig.kt
โฐ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build and Test
๐Ÿ”‡ Additional comments (3)
src/main/kotlin/com/dcd/server/core/common/aop/LockAspect.kt (1)

35-35: ๋กœ๊ทธ ๋ ˆ๋ฒจ ๋ณ€๊ฒฝ ๋ฐ ๋ฉ”์‹œ์ง€ ํ˜•์‹ ๊ฐœ์„ ์ด ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค.

๋ฝ ํš๋“ ์‹คํŒจ ์‹œ ๋กœ๊ทธ ๋ ˆ๋ฒจ์„ debug์—์„œ error๋กœ ๋ณ€๊ฒฝํ•˜๊ณ , ๋ฉ”์‹œ์ง€ ํ˜•์‹์„ "Lock ํš๋“ ์‹คํŒจ: $lockKey"๋กœ ๊ฐœ์„ ํ•œ ๊ฒƒ์€ ๋งค์šฐ ์ ์ ˆํ•ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๋ฝ ํš๋“ ์‹คํŒจ์™€ ๊ฐ™์€ ์ค‘์š”ํ•œ ์ด๋ฒคํŠธ๊ฐ€ ๋” ์ž˜ ๊ด€์ฐฐ๋˜๊ณ , ๋กœ๊ทธ์—์„œ ๋ฌธ์ œ๋ฅผ ๋” ์‰ฝ๊ฒŒ ์‹๋ณ„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

src/main/kotlin/com/dcd/server/infrastructure/global/config/RedisConfig.kt (2)

3-5: ํ•„์š”ํ•œ ์ž„ํฌํŠธ ์ถ”๊ฐ€ ํ™•์ธ.

RedissonClient ๊ด€๋ จ ๊ธฐ๋Šฅ์„ RedisConfig ํด๋ž˜์Šค๋กœ ํ†ตํ•ฉํ•˜๊ธฐ ์œ„ํ•œ ํ•„์š”ํ•œ ์ž„ํฌํŠธ๋“ค์ด ์ ์ ˆํ•˜๊ฒŒ ์ถ”๊ฐ€๋˜์—ˆ์Šต๋‹ˆ๋‹ค.


28-33:

โ“ Verification inconclusive

Redis ์„ค์ • ํ†ตํ•ฉ์ด ์ ์ ˆํ•˜๊ฒŒ ๊ตฌํ˜„๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

RedissonConfig ํด๋ž˜์Šค์—์„œ ์ œ๊ณตํ•˜๋˜ ๊ธฐ๋Šฅ์„ RedisConfig ํด๋ž˜์Šค๋กœ ํ†ตํ•ฉํ•œ ๊ฒƒ์€ ์ข‹์€ ์ ‘๊ทผ ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด Redis ๊ด€๋ จ ์„ค์ •์ด ํ•œ ๊ณณ์—์„œ ๊ด€๋ฆฌ๋˜๋ฏ€๋กœ ์ฝ”๋“œ์˜ ๊ฐ€๋…์„ฑ๊ณผ ์œ ์ง€๋ณด์ˆ˜์„ฑ์ด ํ–ฅ์ƒ๋ฉ๋‹ˆ๋‹ค.

์„ค์ • ๋ฐฉ์‹๋„ ๊ธฐ์กด๊ณผ ๋™์ผํ•˜๊ฒŒ ์œ ์ง€ํ•˜์—ฌ ํ˜ธํ™˜์„ฑ ๋ฌธ์ œ๋ฅผ ์ตœ์†Œํ™”ํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹จ์ผ Redis ์„œ๋ฒ„ ์—ฐ๊ฒฐ ์„ค์ •์ด ๊ฐ„๊ฒฐํ•˜๊ฒŒ ๊ตฌํ˜„๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค๋งŒ, PR ๋ชฉํ‘œ์— ์–ธ๊ธ‰๋œ ๋Œ€๋กœ API ํ˜ธํ™˜์„ฑ ์ด์Šˆ๊ฐ€ ์žˆ์„ ์ˆ˜ ์žˆ์œผ๋‹ˆ ์ด ๋ถ€๋ถ„์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ๊ฐ€ ์ง„ํ–‰๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๊ฒƒ์ด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.


๐Ÿ Script executed:

#!/bin/bash
# RedissonClient๋ฅผ ์ฃผ์ž…๋ฐ›๋Š” ํด๋ž˜์Šค๋“ค์„ ์ฐพ์•„ ๋ฆฌํŒฉํ† ๋ง ์ดํ›„์—๋„ ์ •์ƒ ์ž‘๋™ํ•˜๋Š”์ง€ ํ™•์ธ
echo "RedissonClient๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ํด๋ž˜์Šค ๋ชฉ๋ก:"
rg -l "RedissonClient" --type kotlin

Length of output: 239


Redis ์„ค์ • ํ†ตํ•ฉ ๊ตฌํ˜„ ํ™•์ธ ๋ฐ API ํ˜ธํ™˜์„ฑ ํ…Œ์ŠคํŠธ ์žฌ๊ฒ€ํ†  ์š”์ฒญ

  • Redis ์„ค์ • ํ†ตํ•ฉ ๋ฐฉ์‹์€ ์ฝ”๋“œ ๊ฐ€๋…์„ฑ๊ณผ ์œ ์ง€๋ณด์ˆ˜์„ฑ์„ ํฌ๊ฒŒ ํ–ฅ์ƒ์‹œํ‚ค๋ฉฐ, ๋‹จ์ผ ์„œ๋ฒ„ ์—ฐ๊ฒฐ ์„ค์ •๋„ ๊ธฐ์กด๊ณผ ๋™์ผํ•˜๊ฒŒ ์œ ์ง€๋˜์–ด ํฐ ๋ฌธ์ œ ์—†์–ด ๋ณด์ž…๋‹ˆ๋‹ค.
  • ํ˜„์žฌ RedissonClient๋Š” ์•„๋ž˜ ๋‘ ํŒŒ์ผ์—์„œ ์‚ฌ์šฉ ์ค‘์ž„์ด ํ™•์ธ๋˜์—ˆ์Šต๋‹ˆ๋‹ค:
    • src/main/kotlin/com/dcd/server/infrastructure/global/config/RedisConfig.kt
    • src/main/kotlin/com/dcd/server/core/common/aop/LockAspect.kt
  • ๋‹ค๋งŒ, PR ๋ชฉํ‘œ์— ์–ธ๊ธ‰๋œ ๋Œ€๋กœ API ํ˜ธํ™˜์„ฑ ์ด์Šˆ์— ๋Œ€ํ•œ ํ…Œ์ŠคํŠธ๊ฐ€ ์ง„ํ–‰๋˜์—ˆ๋Š”์ง€ ํ•œ ๋ฒˆ ๋” ํ™•์ธํ•ด ์ฃผ์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.
โœจ Finishing Touches
  • ๐Ÿ“ Generate Docstrings

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
๐Ÿชง Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@dolong2 dolong2 merged commit 6fa8ce2 into develop Mar 17, 2025
2 checks passed
@dolong2 dolong2 deleted the refac/redis-connection-config branch March 17, 2025 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
๐Ÿ”จ Refactor ์ฝ”๋“œ ๋ฆฌํŒฉํ† ๋ง 3๏ธโƒฃ Priority: ํ•˜ ์šฐ์„ ์ˆœ์œ„ ํ•˜
Projects
None yet
1 participant