File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
core/src/main/java/fr/sncf/osrd/api Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -240,15 +240,15 @@ public InfraCacheEntry deleteFromInfraCache(String infraId) {
240
240
public FullInfra getInfra (String infraId , String expectedVersion , DiagnosticRecorder diagnosticRecorder )
241
241
throws OSRDError , InterruptedException {
242
242
try {
243
- infraCache .putIfAbsent (infraId , new InfraCacheEntry ());
244
243
var cacheEntry = infraCache .get (infraId );
245
- // download the infra for tests
246
- if (loadIfMissing ) {
247
- return load (infraId , expectedVersion , diagnosticRecorder );
244
+ if (cacheEntry == null || !cacheEntry .status .isStable ) {
245
+ if (loadIfMissing ) {
246
+ // download the infra for tests
247
+ return load (infraId , expectedVersion , diagnosticRecorder );
248
+ } else
249
+ throw new OSRDError (ErrorType .InfraNotLoadedException );
248
250
}
249
251
var obsoleteVersion = expectedVersion != null && !expectedVersion .equals (cacheEntry .version );
250
- if (!cacheEntry .status .isStable )
251
- throw new OSRDError (ErrorType .InfraNotLoadedException );
252
252
if (obsoleteVersion ) {
253
253
deleteFromInfraCache (infraId );
254
254
throw new OSRDError (ErrorType .InfraInvalidVersionException );
You can’t perform that action at this time.
0 commit comments