Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.