Skip to content
Snippets Groups Projects
Commit 1026ce24 authored by Derek Hudson's avatar Derek Hudson
Browse files

Merge branch 'aws-fix-silent-errors' into 'master'

Fixes silent errors for certain cases where S3 service is down or request rate is too high.

See merge request !1000
parents 9a6aebcd 979340d8
No related branches found
No related tags found
1 merge request!1000Fixes silent errors for certain cases where S3 service is down or request rate is too high.
Pipeline #312493 passed
......@@ -101,7 +101,7 @@ public class CloudStorageImpl implements ICloudStorage {
CompletableFuture<List<RecordProcessor>> results = CompletableFuture.allOf(cfs)
.thenApply(ignored -> futures.stream()
.map(CompletableFuture::join)
.collect(Collectors.toList()));
.toList());
List<RecordProcessor> recordProcessors = results.get();
for(RecordProcessor recordProcessor : recordProcessors){
......@@ -112,6 +112,7 @@ public class CloudStorageImpl implements ICloudStorage {
, recordProcessor.getRecordId()
, recordProcessor.getException().getErrorMessage()
));
throw recordProcessor.getException();
}
}
} catch (Exception e) {
......
......@@ -138,7 +138,18 @@ class CloudStorageImplTest {
}
@Test
void write_shouldThrowAppException_whenRecordProcessingFails() {
void write_shouldThrowException_whenRecordProcessingHasException() {
when(recordProcessing.getRecordData()).thenReturn(recordData);
doNothing().when(userAccessService).validateRecordAcl(any());
when(recordProcessing.getRecordMetadata()).thenReturn(record);
doThrow(AmazonServiceException.class).when(s3RecordClient).saveRecord(recordProcessing, dataPartition);
assertThrows(AppException.class, () -> repo.write(recordProcessing));
}
@Test
void write_shouldThrowAppException_whenRecordProcessingThrowsException() {
when(recordProcessing.getRecordData()).thenReturn(recordData);
doNothing().when(userAccessService).validateRecordAcl(any());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment