diff --git a/front50-s3/src/main/java/com/netflix/spinnaker/front50/model/S3Support.java b/front50-s3/src/main/java/com/netflix/spinnaker/front50/model/S3Support.java index 7f35b3f54..b61137fad 100644 --- a/front50-s3/src/main/java/com/netflix/spinnaker/front50/model/S3Support.java +++ b/front50-s3/src/main/java/com/netflix/spinnaker/front50/model/S3Support.java @@ -213,8 +213,19 @@ protected Set fetchAllItems(Set existingItems) { .buffer(10) .flatMap(ids -> Observable .from(ids) - .flatMap(s3ObjectSummary -> - Observable.just(amazonS3.getObject(s3ObjectSummary.getBucketName(), s3ObjectSummary.getKey())) + .flatMap(s3ObjectSummary -> { + try { + return Observable.just(amazonS3.getObject(s3ObjectSummary.getBucketName(), s3ObjectSummary.getKey())); + } catch (AmazonS3Exception e) { + if (e.getStatusCode() == 404) { + // an item has been removed between the time that object summaries were fetched and now + existingItemsByName.remove(extractItemName(s3ObjectSummary)); + return Observable.empty(); + } + + throw e; + } + } ) .subscribeOn(scheduler) ) @@ -292,5 +303,6 @@ private String extractItemName(S3ObjectSummary s3ObjectSummary) { } abstract Class getSerializedClass(); + abstract String getMetadataFilename(); }