77import lombok .NonNull ;
88import lombok .RequiredArgsConstructor ;
99import lombok .extern .slf4j .Slf4j ;
10- import org .cardanofoundation .rosetta .client .model .domain .*;
10+ import org .cardanofoundation .rosetta .client .model .domain .TokenCacheEntry ;
11+ import org .cardanofoundation .rosetta .client .model .domain .TokenRegistryBatchRequest ;
12+ import org .cardanofoundation .rosetta .client .model .domain .TokenRegistryBatchResponse ;
13+ import org .cardanofoundation .rosetta .client .model .domain .TokenSubject ;
1114import org .springframework .beans .factory .annotation .Value ;
12- import org .springframework .scheduling .annotation .Scheduled ;
1315import org .springframework .stereotype .Service ;
1416
1517import java .io .IOException ;
@@ -35,7 +37,7 @@ public class CachingTokenRegistryHttpGatewayImpl implements TokenRegistryHttpGat
3537 @ Value ("${cardano.rosetta.TOKEN_REGISTRY_BASE_URL:https://tokens.cardano.org/api}" )
3638 protected String tokenRegistryBaseUrl ;
3739
38- @ Value ("${cardano.rosetta.HTTP_REQUEST_TIMEOUT_SECONDS :2}" ) // aggressive timeout as we do not want to block the request
40+ @ Value ("${cardano.rosetta.TOKEN_REGISTRY_REQUEST_TIMEOUT_SECONDS :2}" ) // aggressive timeout as we do not want to block the request
3941 protected int httpRequestTimeoutSeconds ;
4042
4143 @ Value ("${cardano.rosetta.TOKEN_REGISTRY_LOGO_FETCH:false}" )
@@ -84,7 +86,7 @@ public Map<String, Optional<TokenSubject>> getTokenMetadataBatch(@NonNull Set<St
8486 return result ;
8587 }
8688
87- log .info ("Initiating remote token registry request for {} subjects" , subjectsToFetch .size ());
89+ log .info ("Initiating remote token registry HTTP POST request: {} for {} subjects" , batchEndpointUrl , subjectsToFetch .size ());
8890 log .debug ("Subjects to fetch from token registry: {}" , subjectsToFetch );
8991
9092 Stopwatch stopwatch = Stopwatch .createStarted ();
@@ -162,17 +164,12 @@ public Map<String, Optional<TokenSubject>> getTokenMetadataBatch(@NonNull Set<St
162164 }
163165 }
164166
167+ /** helper for testing */
165168 void evictFromCache (String subject ) {
166169 tokenMetadataCache .invalidate (subject );
167170 log .debug ("Evicted cache entry for subject: {}" , subject );
168171 }
169172
170- @ Scheduled (fixedRateString = "${cardano.rosetta.TOKEN_REGISTRY_CACHE_CLEAR_RATE:15m}" )
171- void clearCache () {
172- tokenMetadataCache .invalidateAll ();
173- log .info ("Cleared all token metadata cache entries." );
174- }
175-
176173 List <String > buildPropertiesList () {
177174 List <String > properties = new ArrayList <>();
178175
0 commit comments