Skip to content

실시간 시세 조회 API 구현 - #45

Merged
polynomeer merged 13 commits into
mainfrom
feature/14-price-inquiry
Aug 20, 2025
Merged

실시간 시세 조회 API 구현#45
polynomeer merged 13 commits into
mainfrom
feature/14-price-inquiry

Conversation

@polynomeer

@polynomeer polynomeer commented Aug 2, 2025

Copy link
Copy Markdown
Collaborator

관련 이슈

Close #14, #20, #21, #22, #23


작업 내용 요약

  • 종목 하나에 대한 시세조회 API 구현
  • Redis 캐시 조회 로직 구현
  • 캐시 miss 시 TimescaleDB 조회 fallback 구현
  • Redis TTL 전략 적용

@polynomeer polynomeer changed the title feature/14-price-inquiry 실시간 시세 조회 API 구현 Aug 6, 2025
@polynomeer
polynomeer force-pushed the feature/14-price-inquiry branch from 61d6606 to 638a200 Compare August 11, 2025 14:04
@polynomeer
polynomeer requested a review from if-else-f August 12, 2025 12:48
Comment thread app/app-api-price/build.gradle.kts
@if-else-f

Copy link
Copy Markdown

전체적으로 코드의 수준이 매우 높네요.
깔끔하고 가독성이 좋아요

- Introduced single-flight mechanism to collapse concurrent cache misses
- Added saveIfAbsent (SET NX) support to prevent redundant Redis writes
- Separated cache write logic to skip when value already exists and is identical
- Modified getCurrentPrice to catch CompletionException from CompletableFuture.join()
  and rethrow underlying PriceNotFoundException directly
- Updated unit tests to run synchronously with injected executor/backoff for determinism
- Adjusted verifications to account for multiple cache lookups and saveIfAbsent usage
…ncurrent cache miss, and backoff behavior

- Verified that cache hits return immediately without accessing DB or performing redundant writes
- Ensured concurrent requests on cache miss collapse into a single DB read and Redis write
- Confirmed that during backoff, if a peer fills the cache, the service reuses it and skips writing

These tests improve confidence in cache coordination logic and concurrency handling.
…xecutor injection

- Extracted cache retry count into PriceCacheProperties using @ConfigurationProperties
- Registered PriceCacheProperties via @EnableConfigurationProperties
- Introduced PriceCacheConfig to provide Executor and BackoffStrategy beans
- Moved executor and backoff injection to constructor (supports @requiredargsconstructor)
- Defaulted to fixed thread pool executor using availableProcessors()
- Simplified loadOnce logic with Optional chaining for readability
- Relocated configuration classes to shared-config module for modular clarity
- Implemented TimeSeriesPriceRepositoryImpl using JdbcTemplate
- Removed mock-based test and integrated in-memory H2 test
- Query now fetches latest price by ticker code from price_history table
- Added debug logs for SQL execution and result mapping
- Adapted test to use US stock symbols (e.g., AAPL) instead of mock
- Ensured compatibility with Spring Boot and PostgreSQL-compatible H2 mode
…ticker module

- Introduced TickerFormat class with static regex pattern for ticker validation
- Defined TICKER_PATTERN supporting major international formats (e.g. AAPL, BRK.B)
- Added isValid(String) helper method for reuse across controllers and services
- Enforced separation of concerns by locating pattern in domain-ticker, not shared or app modules
@polynomeer
polynomeer requested a review from if-else-f August 20, 2025 01:15
@polynomeer
polynomeer merged commit 07cc970 into main Aug 20, 2025
1 check passed
@polynomeer
polynomeer deleted the feature/14-price-inquiry branch August 20, 2025 14:06
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