This reverts commit 2083b7ca74
.
This commit is contained in:
parent
9822e8939f
commit
9492999ed6
|
@ -1,6 +0,0 @@
|
|||
---
|
||||
type: add
|
||||
issue: 4566
|
||||
title: "When creating or modifying a SearchParameter in the JPA server, the local SearchParameter cache
|
||||
is now immediately flushed. This should help with situations such as tests where a SearchParameter
|
||||
is created and then used before the scheduled cache refresh typically occurs."
|
|
@ -9,8 +9,6 @@ import com.google.common.annotations.VisibleForTesting;
|
|||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.r5.model.CodeType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -44,21 +42,6 @@ public class JpaResourceDaoSearchParameter<T extends IBaseResource> extends Base
|
|||
private SearchParameterDaoValidator mySearchParameterDaoValidator;
|
||||
|
||||
protected void reindexAffectedResources(T theResource, RequestDetails theRequestDetails) {
|
||||
|
||||
/*
|
||||
* After we commit, flush the search parameter cache. This only helps on the
|
||||
* local server (ie in a cluster the other servers won't be flushed) but
|
||||
* the cache is short anyhow, and flushing locally is better than nothing.
|
||||
* Many use cases where you would create a search parameter and immediately
|
||||
* try to use it tend to be on single-server setups anyhow, e.g. unit tests
|
||||
*/
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
mySearchParamRegistry.forceRefresh();
|
||||
}
|
||||
});
|
||||
|
||||
// N.B. Don't do this on the canonicalized version
|
||||
Boolean reindex = theResource != null ? CURRENTLY_REINDEXING.get(theResource) : null;
|
||||
|
||||
|
|
|
@ -1744,7 +1744,6 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test
|
|||
|
||||
@Test
|
||||
public void testCompositeWithInvalidTarget() {
|
||||
// Setup
|
||||
SearchParameter sp = new SearchParameter();
|
||||
sp.addBase("Patient");
|
||||
sp.setCode("myDoctor");
|
||||
|
@ -1753,15 +1752,14 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test
|
|||
sp.setStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE);
|
||||
sp.addComponent()
|
||||
.setDefinition("http://foo");
|
||||
mySearchParameterDao.create(sp);
|
||||
|
||||
IAnonymousInterceptor interceptor = mock(IAnonymousInterceptor.class);
|
||||
myInterceptorRegistry.registerAnonymousInterceptor(Pointcut.JPA_PERFTRACE_WARNING, interceptor);
|
||||
|
||||
try {
|
||||
// Test
|
||||
mySearchParameterDao.create(sp);
|
||||
mySearchParamRegistry.forceRefresh();
|
||||
|
||||
// Verify
|
||||
ArgumentCaptor<HookParams> paramsCaptor = ArgumentCaptor.forClass(HookParams.class);
|
||||
verify(interceptor, times(1)).invoke(any(), paramsCaptor.capture());
|
||||
|
||||
|
|
|
@ -401,6 +401,10 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide
|
|||
fooSp.setStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE);
|
||||
mySearchParameterDao.create(fooSp, mySrd);
|
||||
|
||||
myCaptureQueriesListener.clear();
|
||||
mySearchParamRegistry.forceRefresh();
|
||||
myCaptureQueriesListener.logAllQueriesForCurrentThread();
|
||||
|
||||
Patient pat = new Patient();
|
||||
pat.setGender(AdministrativeGender.MALE);
|
||||
IIdType patId = myPatientDao.create(pat, mySrd).getId().toUnqualifiedVersionless();
|
||||
|
|
Loading…
Reference in New Issue