add test for failing batch bug, remove bounding on queue

This commit is contained in:
Tadgh 2021-09-13 19:52:44 -04:00
parent 7dfe628551
commit 0c123384c7
2 changed files with 19840 additions and 0 deletions

View File

@ -5,9 +5,15 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import com.google.common.base.Charsets;
import org.apache.commons.io.IOUtils;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
@ -110,6 +116,24 @@ public class ResourceProviderR4BundleTest extends BaseResourceProviderR4Test {
}
@Test
public void testHighConcurrencyWorks() throws IOException, InterruptedException {
myDaoConfig.setBundleBatchPoolSize(20);
myDaoConfig.setBundleBatchMaxPoolSize(100);
List<Bundle> bundles = new ArrayList<>();
for (int i =0 ; i < 20; i ++) {
bundles.add(myFhirCtx.newJsonParser().parseResource(Bundle.class, IOUtils.toString(getClass().getResourceAsStream("/r4/identical-tags-batch.json"), Charsets.UTF_8)));
}
ExecutorService tpe = Executors.newFixedThreadPool(4);
for (Bundle bundle :bundles) {
tpe.execute(() -> myClient.transaction().withBundle(bundle).execute());
}
tpe.shutdown();;
tpe.awaitTermination(100, TimeUnit.SECONDS);
}
@Test
public void testBundleBatchWithSingleThread() {
List<String> ids = createPatients(50);

File diff suppressed because it is too large Load Diff