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

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

parent 9a6aebcd
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 #312327 failed
......@@ -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