Skip to content

차트 시세 조회 구현#46

Merged
polynomeer merged 14 commits intomainfrom
feature/16-price-chart
Sep 17, 2025
Merged

차트 시세 조회 구현#46
polynomeer merged 14 commits intomainfrom
feature/16-price-chart

Conversation

@polynomeer
Copy link
Collaborator

No description provided.

Remove dependency for external API. Only collector calls external API.

Add exception handling for cache and DB access logic, wrapping with try~catch block
- 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:13
@polynomeer polynomeer merged commit d7b1b6c into main Sep 17, 2025
1 check 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.

1 participant